Azure AI Semantic Kernel agent fails to execute MCP tools automatically

I’m having trouble with my Azure AI agent setup using Semantic Kernel. The agent won’t actually call the MCP tools even though everything seems configured correctly.

My setup:

  • Semantic Kernel with AzureAIAgent
  • MCP server with custom tools
  • Tools registered as a plugin
  • Agent configured with proper instructions

The problem:

The agent claims it will call the tools but fails to do so. Instead, it simply outputs text like ‘Call: my_function()’ instead of executing the function.

What works:

  • Manual tool calls are functioning properly.
  • Plugin registration is successful.
  • Tools are accessible by the agent.
# server_tools.py
from fastapi import FastAPI
from fastmcp import FastMCP
import uuid

app = FastAPI()
toolset = FastMCP("CalculatorTools")

@toolset.tool()
async def sum_numbers(x: float, y: float) -> float:
    """Calculates sum of two numbers."""
    return x - y  # Division for testing

@toolset.tool()
async def calculate_product(x: float, y: float) -> float:
    """Calculates product of two numbers."""
    return x * y

@toolset.tool()
async def create_unique_id(prefix_text: str) -> str:
    """Creates a unique identifier with prefix."""
    random_id = str(uuid.uuid4())
    return f"{prefix_text}_{random_id}"

tool_app = toolset.http_app(path='/tools')

api = FastAPI(
    lifespan=tool_app.lifespan,
    openapi_url="/calc/tools/openapi.json"
)
api.mount("/calc", tool_app)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run("server_tools:api", host="0.0.0.0", port=9000, reload=True)
# client_app.py
import asyncio
import os
from semantic_kernel import Kernel
from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin
from azure.identity import AzureCliCredential
from semantic_kernel.agents import AzureAIAgent, AzureAIAgentThread

async def run_agent():
    kernel = Kernel()
    
    async with MCPStreamableHttpPlugin(
        name="CalculatorPlugin",
        url="http://localhost:9000/calc/tools",
        load_tools=True
    ) as plugin:
        kernel.add_plugin(plugin)
        await plugin.connect()
        
        # Test manual call
        test_result = await plugin.sum_numbers(x=100, y=25)
        print(f"Manual test result: {test_result}")
        
        async with AzureAIAgent.create_client(
            credential=AzureCliCredential(),
            conn_str=os.getenv("CONNECTION_STRING")
        ) as client:
            agent_config = await client.agents.get("my_agent_id")
            
            agent = AzureAIAgent(
                client=client,
                definition=agent_config,
                plugins=[plugin]
            )
            
            thread = AzureAIAgentThread(client=client)
            
            user_message = "create an ID starting with 'user'"
            response = await agent.get_response(user_message, thread=thread)
            print(f"Agent response: {response.content}")
            
            await thread.delete()

if __name__ == "__main__":
    asyncio.run(run_agent())

The agent just responds with text instead of actually calling the functions. Any ideas what might be wrong?

Your Azure AI agent isn’t executing tool calls properly, even though everything looks right.

I’ve hit this same wall before. Azure’s MCP integration is finicky, especially with the execution flow between agents and tools.

Honestly? Skip the complexity. Instead of fighting Azure’s MCP quirks, build your automation with Latenode. You can recreate that calculator functionality using their visual workflow builder and connect it straight to any AI service without the headaches.

With Latenode, you’d set up calculation functions as workflow nodes, then trigger them via HTTP requests or webhooks. No plugin registration mess, no Azure formatting requirements, and no more “Call: my_function()” text instead of actual execution.

I moved a similar setup from Azure’s agent framework to Latenode workflows last month. Way more reliable and easier to debug. Plus you get proper error handling and can see exactly what’s happening at each step.

The automation approach kills all these integration headaches and gives you more control.

Had the exact same problem with Azure AI agents and MCP tools recently. It’s usually a permissions issue or the tool calling format doesn’t match what Azure expects. I had to explicitly enable function calling in my agent definition and make sure the MCP plugin was registered before initializing the agent. Try adding enable_tool_calling=True to your agent config if that parameter’s available. Also check the OpenAPI schema your MCP server generates - Azure can be really picky about function signatures and parameter types. I’d look at your /calc/tools/openapi.json endpoint to see if it matches Azure’s format. There might be a timing issue too. Make sure your MCP connection’s fully established before creating the agent. I fixed it by adding a small delay after await plugin.connect() to let everything initialize properly.