microsoft/semantic-kernel · error · McpError

METHOD_NOT_FOUND

METHOD_NOT_FOUND

Error message

Unknown tool: {function_name}

What it means

Raised inside the SK-as-MCP-server handler _call_tool (mcp.py:1125) as an McpError with code METHOD_NOT_FOUND when the incoming tool name is not in exposed_names (the set of kernel function names registered for exposure). This is server-side: Semantic Kernel is acting as an MCP server and a client requested a tool it never registered. The error is returned to the MCP client as a structured error response.

Source

Thrown at python/semantic_kernel/connectors/mcp.py:1125

                            for param in func.parameters
                            if param.name and param.is_required and param.include_in_function_choices
                        ],
                    },
                )
                for func in functions_to_expose
            ]
            await _log(level="debug", data=f"List of tools: {tools}")
            await asyncio.sleep(0.0)
            return tools

        @server.call_tool()
        async def _call_tool(
            *args: Any,
        ) -> Sequence[types.TextContent | types.ImageContent | types.AudioContent | types.EmbeddedResource]:
            """Call a tool in the kernel."""
            function_name, arguments = args[0], args[1]
            if function_name not in exposed_names:
                raise McpError(
                    error=types.ErrorData(
                        code=types.METHOD_NOT_FOUND,
                        message=f"Unknown tool: {function_name}",
                    )
                )
            await _log(level="debug", data=f"Calling tool: {function_name}")
            result = await _call_kernel_function(function_name, arguments)
            if result:
                value = result.value
                messages: list[
                    types.TextContent | types.ImageContent | types.AudioContent | types.EmbeddedResource
                ] = []
                if isinstance(value, list):
                    for item in value:
                        match item:
                            case (
                                TextContent() | ImageContent() | BinaryContent() | AudioContent() | ChatMessageContent()
                            ):

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Have the client call tools/list first and use only the returned names.
  2. Verify the requested name matches an exposed kernel function name exactly (after normalization).
  3. Ensure the kernel function is registered before the MCP server exposes its tool list.
  4. On the server side, confirm functions_to_expose includes the desired function and its name passes _normalize_mcp_name.

Example fix

# client side - before
await session.call_tool("Summarise", {...})  # typo / not exposed

# after
await session.call_tool("summarize", {...})  # exact exposed name
Defensive patterns

Strategy: validation

Validate before calling

# client side: fetch the tool list and validate the requested name before calling
async def tool_is_exposed(session, name: str) -> bool:
    tools = await session.list_tools()
    exposed = {t.name for t in tools.tools}
    return name in exposed

Type guard

import re

def name_matches_normalized(requested: str, exposed: set[str]) -> bool:
    normalize = lambda n: re.sub(r"[^A-Za-z0-9_.-]", "-", n)
    return normalize(requested) in {normalize(n) for n in exposed}

Try / catch

# client side
try:
    await session.call_tool("Summarise", {})
except Exception as ex:
    # McpError with METHOD_NOT_FOUND is returned as an error result;
    # re-fetch tools/list and only call known names
    tools = await session.list_tools()
    names = {t.name for t in tools.tools}
    if "Summarise" not in names:
        # pick the correct (normalized) name

Prevention

When it happens

Trigger: An MCP client calls a tool name that was not exposed via the server's functions_to_expose list; a typo in the tool name; the tool was filtered out during exposure; the client cached a stale tool list. Guard at mcp.py:1124-1130.

Common situations: Client using an outdated tool list after the server removed/renamed a function; case-sensitivity mismatch (note _normalize_mcp_name rewrites names); plugin was added to the kernel after the server enumerated tools; client guessed a name.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/2f6131e0ef44c5da. Report an issue: GitHub.