Skip to content

Python: When using the MCPStreamableHTTPTool with a ChatAgent, it advertises duplicate tools to the LLM, causing a failure. #1876

Description

@westey-m

We have a code snippet that is using an MCP server. The MCP server is exposing 2 function tools.

async def create_agent():
    credential = DefaultAzureCredential()
   
    # Connect to ContentUnderstandMCP-Remote tool
    mcp_tool = MCPStreamableHTTPTool(
            name="content_understanding_agent_v1",
            url="http://127.0.0.1:3001/mcp"),
        )
   
    agent = ChatAgent(
        chat_client=AzureAIAgentClient(
            project_endpoint=project_endpoint,
            model_deployment_name=model_deployment,
            async_credential=credential,
            agent_name="ContentAnalysisBot",
        ),
        instructions="You are a helpful assistant with access to content understanding tools. You can analyze documents, images, and other content types to extract information and answer questions about them.",
        tools=mcp_tool
    )
    return agent, credential, mcp_tool

However, when running the agent, it is failing with a 400 error from Foundry, saying that there are duplicate tools.
When inspecting the tools on the agent, the tools from the MCP server are indeed duplicated:

Image

CC @vkurpad

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsUsage: [Issues, PRs], Target: Single agentpythonUsage: [Issues, PRs], Target: Python

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions