{"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":913,"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":895,"sourceCodeEnd":931,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/servers/mcp-server.ts#L895-L931","documentation":"Thrown by the CallToolRequest handler when no entry in the tools array matches request.params.name. The MCP server advertises a fixed tool list in ListTools; if a client calls a name not in that list, the lookup finds undefined and this Error is thrown before any handler runs.","triggerScenarios":"An MCP client sends tools/call with a name that is misspelled, removed in this version, or fabricated (e.g. 'memorize', 'remember'). Also when a client caches an older tool list after an upgrade that renamed/removed tools.","commonSituations":"Version skew: client discovered tools on an older server and calls a now-removed tool; typo in a hand-written JSON-RPC call; tool name was renamed (e.g. observation_add vs add_observation) and the caller uses the old spelling.","solutions":["Re-list tools via tools/list and call only names that appear in the current response.","Upgrade (or downgrade) the client and server to matching versions so advertised names align.","Check the exact spelling and casing against the tools array in src/servers/mcp-server.ts."],"exampleFix":"// before — client calls a non-existent tool\n{ \"method\": \"tools/call\", \"params\": { \"name\": \"remember\", \"arguments\": {} } }\n// throws 'Unknown tool: remember'\n\n// after — use a name from tools/list\n{ \"method\": \"tools/call\", \"params\": { \"name\": \"observation_add\", \"arguments\": { \"content\": \"...\" } } }","handlingStrategy":"validation","validationCode":"// Before calling tools/call, confirm the name was advertised by tools/list.\nconst advertised = (await client.listTools()).tools.map(t => t.name);\nif (!advertised.includes(requestedName)) {\n  throw new Error(`Tool '${requestedName}' not advertised; available: ${advertised.join(', ')}`);\n}","typeGuard":"function isAdvertisedTool(name: string, advertised: string[]): boolean {\n  return advertised.includes(name);\n}","tryCatchPattern":"try {\n  await server.request({ method: 'tools/call', params: { name, arguments } });\n} catch (e) {\n  if (e instanceof Error && /Unknown tool/.test(e.message)) {\n    // refresh the tool list and retry only if the name now exists\n    await client.refreshTools();\n  } else throw e;\n}","preventionTips":["Re-discover tools via tools/list after every server upgrade; do not cache the list across versions.","Match exact spelling and casing against the advertised names.","Have clients surface 'Unknown tool' by refreshing the tool list rather than retrying blindly."],"tags":["mcp","protocol","tool-routing"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}