{"record":{"id":"d52330ba46816f65","repo":"n8n-io/n8n","slug":"require-a-sessionid-for-the-listing-of-tools","errorCode":null,"errorMessage":"Require a sessionId for the listing of tools","messagePattern":"Require a sessionId for the listing of tools","errorType":"exception","errorClass":"OperationalError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/mcp/McpTrigger/McpServer.ts","lineNumber":600,"sourceCode":"\t\t\t} catch (error) {\n\t\t\t\tthis.logger.warn(\n\t\t\t\t\t`Credential gate elicitation failed, falling back to text response: ${\n\t\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t\t}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (this.resolveFunctions[callId]) this.resolveFunctions[callId]();\n\t\treturn MessageFormatter.formatCredentialGate(gateResult);\n\t}\n\n\tprivate setupHandlers(server: Server): void {\n\t\tserver.setRequestHandler(\n\t\t\tListToolsRequestSchema,\n\t\t\t(_, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => {\n\t\t\t\tif (!extra.sessionId) {\n\t\t\t\t\tthrow new OperationalError('Require a sessionId for the listing of tools');\n\t\t\t\t}\n\n\t\t\t\tconst tools = this.sessionManager.getTools(extra.sessionId) ?? [];\n\t\t\t\treturn {\n\t\t\t\t\ttools: tools.map((tool) => ({\n\t\t\t\t\t\tname: tool.name,\n\t\t\t\t\t\tdescription: tool.description,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument\n\t\t\t\t\t\tinputSchema: zodToJsonSchema(tool.schema as any, {\n\t\t\t\t\t\t\tremoveAdditionalStrategy: 'strict',\n\t\t\t\t\t\t}),\n\t\t\t\t\t})),\n\t\t\t\t};\n\t\t\t},\n\t\t);\n\n\t\tserver.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n\t\t\tif (!extra.sessionId) {","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/mcp/McpTrigger/McpServer.ts#L582-L618","documentation":"ListTools request handler guard: the MCP SDK's request context carries no sessionId, but the trigger's tool listing is per-session (tools come from the session manager). Without a session there is no toolset to list, so an OperationalError is thrown to the client.","triggerScenarios":"Thrown at packages/@n8n/nodes-langchain/nodes/mcp/McpTrigger/McpServer.ts:600 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the client complete the initialize handshake so a session id is assigned","Ensure the proxy/gateway forwards the session id header"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","contentChangedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}