{"record":{"id":"a55496b07a61a089","repo":"thedotmack/claude-mem","slug":"unknown-tool-request-params-name","errorCode":null,"errorMessage":"Unknown tool: ${request.params.name}","messagePattern":"Unknown tool: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/servers/mcp-server.ts","lineNumber":945,"sourceCode":"  }\n);\n\nserver.setRequestHandler(ListToolsRequestSchema, async () => {\n  const advertisedTools = getAdvertisedMcpToolsForRuntime(tools, selectRuntime());\n  return {\n    tools: advertisedTools.map(tool => ({\n      name: tool.name,\n      description: tool.description,\n      inputSchema: tool.inputSchema\n    }))\n  };\n});\n\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\n  const tool = tools.find(t => t.name === request.params.name);\n\n  if (!tool) {\n    throw new Error(`Unknown tool: ${request.params.name}`);\n  }\n\n  try {\n    return await tool.handler(request.params.arguments || {});\n  } catch (error: unknown) {\n    logger.error('SYSTEM', 'Tool execution failed', { tool: request.params.name }, error instanceof Error ? error : new Error(String(error)));\n    return {\n      content: [{\n        type: 'text' as const,\n        text: `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`\n      }],\n      isError: true\n    };\n  }\n});\n\nconst HEARTBEAT_INTERVAL_MS = 30_000;\nlet heartbeatTimer: ReturnType<typeof setInterval> | null = null;","sourceCodeStart":927,"sourceCodeEnd":963,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/servers/mcp-server.ts#L927-L963","documentation":"The MCP server's CallToolRequest handler looks up the requested tool by name in its registered `tools` array. If no tool matches `request.params.name`, it throws this error, since the server has no handler to dispatch to. Unlike protocol-level 'method not found', this means the method was CallTool/call but the tool name is not registered on this server.","triggerScenarios":"Client calls a tool name that does not exist in this server's tools list (typo, removed/renamed tool, wrong server), or calls a tool before the server registered it.","commonSituations":"Tool renamed between plugin versions while the client caches the old tool list; LLM hallucinating a tool name; connecting a client configured for a different MCP server; stale tool list after the server restarted with fewer tools.","solutions":["Call `tools/list` to fetch the current tool names and use an exact match.","Fix the tool name spelling in the client/LLM prompt.","Restart the client so it refreshes its cached tool list after server changes.","Confirm you are connected to the intended MCP server that registers this tool."],"exampleFix":"// before\nawait client.callTool({ name: 'query_corpus_by_name', arguments: {...} });\n// after\nawait client.callTool({ name: 'query_corpus', arguments: { name: 'notes', question: '...' } });","handlingStrategy":"validation","validationCode":"const toolNames = (await client.listTools()).tools.map(t => t.name);\nif (!toolNames.includes('query_corpus')) throw new Error(`Tool not available; have: ${toolNames.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try { return await client.callTool({ name, arguments: args }); } catch (e) { if (String(e.message).startsWith('Unknown tool:')) { const names = (await client.listTools()).tools.map(t => t.name); throw new Error(`'${name}' not found. Available: ${names.join(', ')}`); } throw e; }","preventionTips":["Refresh the tool list after server upgrades instead of caching names.","Copy tool names from tools/list output verbatim.","Constrain LLM tool choice to the advertised tool list.","Verify you are connected to the correct MCP server for the tool."],"tags":["mcp","unknown-tool","dispatch"],"backgroundTag":"invalid-argument-value","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}