Azure / Azure/azure-sdk-for-python

[azure-ai-agentserver-core] Connected MCP tools route returns 404 for hosted LangGraph agent (`/agents/{agent}/tools/resolve`)

Open
#46,173 1 comment 0 reactions 2 assignees Claimed by @JC-386 View on GitHub
customer-reported Hosted Agents needs-team-attention question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

## Package Versions
- `azure-ai-agentserver-core`: `1.0.0b17`
- `azure-ai-agentserver-langgraph`: `1.0.0b17`
- `azure-ai-projects`: `2.0.0b3`
- Python: `<3.10/3.11/3.12>`
- OS: `Windows`

## Description
When using `azure-ai-agentserver-langgraph` with Foundry connected MCP tools (`{"type":"mcp","project_connection_id":"..."}`), tool resolution/invocation fails because the connected-tools proxy route returns `404`.

The SDK appears to call:
- `POST /api/projects/{project}/agents/{agent}/tools/resolve?api-version=2025-11-15-preview`
- `POST /api/projects/{project}/agents/{agent}/tools/invoke?api-version=2025-11-15-preview`

These return `404` in hosted-agent scenarios.

## Repro Steps
1. Create a hosted LangGraph agent with `use_foundry_tools(...)`.
2. Include at least one connected MCP tool:
- `{"type":"mcp","project_connection_id":""}`
3. Invoke the agent through project Responses API.
4. Observe failure during connected tool resolution or invocation.

## Minimal Agent Snippet
```python
from azure.ai.agentserver.langgraph import from_langgraph
from azure.ai.agentserver.langgraph.tools import use_foundry_tools

foundry_tools = [
{"type": "code_interpreter"},
{"type": "mcp", "project_connection_id": ""},
]

# middleware=[use_foundry_tools(foundry_tools)]
# invoke agent via project Responses API
```
## Actual Result
- Connected MCP resolve/invoke path returns 404.
- Agent run fails when trying to use connected MCP tools.

Example symptom (sanitized):

- ResourceNotFoundError / HTTP 404 from connected tools route.
- Route shape: /agents/{agent}/tools/resolve and /agents/{agent}/tools/invoke.

# Expected Result
Connected MCP tools should resolve and invoke successfully via SDK without requiring custom monkey patching.

## Why this appears to be SDK route/contract issue
1. In 1.0.0b17, FoundryConnectedToolsOperations uses /agents/{agent}/tools/resolve|invoke with api-version=2025-11-15-preview.
2. Project connections are valid and retrievable via AIProjectClient.connections.get/list.
3. Direct MCP JSON-RPC calls to connection targets (tools/list, tools/call) succeed.
4. Failure is isolated to connected-tools proxy route behavior.

## Temporary Workaround
Implemented runtime monkey patch in app code:

- Catch 404 from connected-tools resolve/invoke.
- Fallback to direct MCP JSON-RPC (tools/list, tools/call) using connection metadata and auth scope.
- This works, but should not be required in user code.

## Impact
- Hosted-agent architectures relying on connected MCP tools cannot use default SDK behavior reliably.
- Forces custom patching and increases operational complexity.

## Requested Fix
- Provide a supported fix in azure-ai-agentserver-core so connected MCP tools work without monkey patches.
- If route contract changed, document required endpoint/version and update SDK accordingly.
- Consider built-in fallback or clearer actionable error when route is unavailable.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.