microsoft/semantic-kernel · error · KernelPluginInvalidConfigurationError

Tools are not loaded for this server, please set load_tools=

Error message

Tools are not loaded for this server, please set load_tools=True in the constructor.

What it means

Thrown by MCPPluginBase.call_tool (mcp.py:614) as a KernelPluginInvalidConfigurationError when load_tools_flag is False. The plugin only registers MCP tools (and their kernel function wrappers) during connect() if load_tools=True at construction; with it disabled, call_tool refuses because no tools were loaded.

Source

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

            func = kernel_function(name=local_name, description=tool.description)(partial(self.call_tool, tool.name))
            func.__kernel_function_parameters__ = _get_parameter_dicts_from_mcp_tool(tool)
            setattr(self, local_name, func)

    @abstractmethod
    def get_mcp_client(self) -> _AsyncGeneratorContextManager[Any, None]:
        """Get an MCP client."""
        pass

    async def call_tool(
        self, tool_name: str, **kwargs: Any
    ) -> list[TextContent | ImageContent | BinaryContent | AudioContent | FunctionResultContent | FunctionCallContent]:
        """Call a tool with the given arguments."""
        if not self.session:
            raise KernelPluginInvalidConfigurationError(
                "MCP server not connected, please call connect() before using this method."
            )
        if not self.load_tools_flag:
            raise KernelPluginInvalidConfigurationError(
                "Tools are not loaded for this server, please set load_tools=True in the constructor."
            )
        try:
            return _mcp_call_tool_result_to_kernel_contents(await self.session.call_tool(tool_name, arguments=kwargs))
        except McpError:
            raise
        except Exception as ex:
            raise FunctionExecutionException(f"Failed to call tool '{tool_name}'.") from ex

    async def get_prompt(self, prompt_name: str, **kwargs: Any) -> list[ChatMessageContent]:
        """Call a prompt with the given arguments."""
        if not self.session:
            raise KernelPluginInvalidConfigurationError(
                "MCP server not connected, please call connect() before using this method."
            )
        if not self.load_prompts_flag:
            raise KernelPluginInvalidConfigurationError(
                "Prompts are not loaded for this server, please set load_prompts=True in the constructor."

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Construct with load_tools=True if you intend to call tools: MCPStdioPlugin(..., load_tools=True).
  2. If you disabled tools intentionally, do not call call_tool; use get_prompt instead.
  3. Re-create the plugin with the correct flags rather than mutating load_tools_flag after the fact.
  4. Confirm the constructor default is load_tools=True, so this only fires when you explicitly disabled it.

Example fix

# before
plugin = MCPStdioPlugin(..., load_tools=False)
await plugin.call_tool("foo")

# after
plugin = MCPStdioPlugin(..., load_tools=True)
Defensive patterns

Strategy: validation

Validate before calling

def can_call_tools(plugin) -> bool:
    return getattr(plugin, "load_tools_flag", False)

Type guard

def plugin_supports_tools(plugin) -> bool:
    return bool(getattr(plugin, "load_tools_flag", False))

Try / catch

from semantic_kernel.exceptions.kernel_exceptions import KernelPluginInvalidConfigurationError

try:
    await plugin.call_tool("foo")
except KernelPluginInvalidConfigurationError as ex:
    if "Tools are not loaded" in str(ex):
        # recreate the plugin with load_tools=True
        plugin = MCPStdioPlugin(..., load_tools=True)

Prevention

When it happens

Trigger: Constructing the plugin with load_tools=False (e.g. to load only prompts) and then calling call_tool. The guard at mcp.py:613-616 fires after the session check.

Common situations: Setting load_tools=False to save startup time or because only prompts were needed, then later attempting a tool call; copy-pasting config from a prompts-only plugin; misunderstanding that load_tools also gates call_tool, not just auto-registration.

Related errors


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