{"record":{"id":"93fb575eced969db","repo":"n8n-io/n8n","slug":"mcp-server-returned-no-tools","errorCode":null,"errorMessage":"MCP Server returned no tools","messagePattern":"MCP Server returned no tools","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts","lineNumber":203,"sourceCode":"/**\n * Connect to the MCP server and return the client + filtered tools, or throw a\n * `NodeOperationError` on connection failure or an empty tool list. The\n * `connectOrThrow` counterpart to {@link connectAndGetTools}.\n */\nasync function connectOrThrow(\n\tctx: IExecuteFunctions,\n\tconfig: ResolvedMcpConfig,\n\titemIndex: number,\n): Promise<{ client: Client; mcpTools: McpTool[] }> {\n\tconst node = ctx.getNode();\n\tconst { client, mcpTools, error } = await connectAndGetTools(ctx, config);\n\n\tif (error) {\n\t\tthrow new NodeOperationError(node, error.error, { itemIndex });\n\t}\n\tif (!mcpTools?.length) {\n\t\tawait client.close();\n\t\tthrow new NodeOperationError(node, 'MCP Server returned no tools', { itemIndex });\n\t}\n\n\treturn { client, mcpTools };\n}\n\n/**\n * Run the tool named in `item.json.tool` against the connected client and push\n * the result onto `returnData`. Shared by the cached and non-cached execute paths.\n */\nasync function runToolCall(opts: {\n\tctx: IExecuteFunctions;\n\tnode: INode;\n\titem: INodeExecutionData;\n\tmcpTools: McpTool[];\n\tclient: Client;\n\ttimeout: number;\n\titemIndex: number;\n\treturnData: INodeExecutionData[];","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts#L185-L221","documentation":"Error \"MCP Server returned no tools\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/nodes-langchain/nodes/mcp/shared/runtime.ts:203 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}