{"record":{"id":"357997b5d18f7ba4","repo":"microsoft/semantic-kernel","slug":"tools-are-not-loaded-for-this-server-please-set-l","errorCode":null,"errorMessage":"Tools are not loaded for this server, please set load_tools=True in the constructor.","messagePattern":"Tools are not loaded for this server, please set load_tools=True in the constructor\\.","errorType":"validation","errorClass":"KernelPluginInvalidConfigurationError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/mcp.py","lineNumber":614,"sourceCode":"            func = kernel_function(name=local_name, description=tool.description)(partial(self.call_tool, tool.name))\n            func.__kernel_function_parameters__ = _get_parameter_dicts_from_mcp_tool(tool)\n            setattr(self, local_name, func)\n\n    @abstractmethod\n    def get_mcp_client(self) -> _AsyncGeneratorContextManager[Any, None]:\n        \"\"\"Get an MCP client.\"\"\"\n        pass\n\n    async def call_tool(\n        self, tool_name: str, **kwargs: Any\n    ) -> list[TextContent | ImageContent | BinaryContent | AudioContent | FunctionResultContent | FunctionCallContent]:\n        \"\"\"Call a tool with the given arguments.\"\"\"\n        if not self.session:\n            raise KernelPluginInvalidConfigurationError(\n                \"MCP server not connected, please call connect() before using this method.\"\n            )\n        if not self.load_tools_flag:\n            raise KernelPluginInvalidConfigurationError(\n                \"Tools are not loaded for this server, please set load_tools=True in the constructor.\"\n            )\n        try:\n            return _mcp_call_tool_result_to_kernel_contents(await self.session.call_tool(tool_name, arguments=kwargs))\n        except McpError:\n            raise\n        except Exception as ex:\n            raise FunctionExecutionException(f\"Failed to call tool '{tool_name}'.\") from ex\n\n    async def get_prompt(self, prompt_name: str, **kwargs: Any) -> list[ChatMessageContent]:\n        \"\"\"Call a prompt with the given arguments.\"\"\"\n        if not self.session:\n            raise KernelPluginInvalidConfigurationError(\n                \"MCP server not connected, please call connect() before using this method.\"\n            )\n        if not self.load_prompts_flag:\n            raise KernelPluginInvalidConfigurationError(\n                \"Prompts are not loaded for this server, please set load_prompts=True in the constructor.\"","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/mcp.py#L596-L632","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Construct with load_tools=True if you intend to call tools: MCPStdioPlugin(..., load_tools=True).","If you disabled tools intentionally, do not call call_tool; use get_prompt instead.","Re-create the plugin with the correct flags rather than mutating load_tools_flag after the fact.","Confirm the constructor default is load_tools=True, so this only fires when you explicitly disabled it."],"exampleFix":"# before\nplugin = MCPStdioPlugin(..., load_tools=False)\nawait plugin.call_tool(\"foo\")\n\n# after\nplugin = MCPStdioPlugin(..., load_tools=True)","handlingStrategy":"validation","validationCode":"def can_call_tools(plugin) -> bool:\n    return getattr(plugin, \"load_tools_flag\", False)","typeGuard":"def plugin_supports_tools(plugin) -> bool:\n    return bool(getattr(plugin, \"load_tools_flag\", False))","tryCatchPattern":"from semantic_kernel.exceptions.kernel_exceptions import KernelPluginInvalidConfigurationError\n\ntry:\n    await plugin.call_tool(\"foo\")\nexcept KernelPluginInvalidConfigurationError as ex:\n    if \"Tools are not loaded\" in str(ex):\n        # recreate the plugin with load_tools=True\n        plugin = MCPStdioPlugin(..., load_tools=True)","preventionTips":["Construct with load_tools=True whenever you intend to call tools.","Remember the default is True; this only fires when you disabled tools.","Do not call call_tool on a prompts-only plugin.","Re-create the plugin with correct flags rather than mutating load_tools_flag."],"tags":["mcp","call-tool","configuration","load-tools"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}