{"record":{"id":"b72ab414995dc362","repo":"can1357/oh-my-pi","slug":"unknown-tool-name","errorCode":null,"errorMessage":"Unknown tool: ${name}","messagePattern":"Unknown tool: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mnemopi/src/mcp-tools.ts","lineNumber":965,"sourceCode":"\tmnemopi_validate: handleValidate,\n\tmnemopi_get: handleGet,\n\tmnemopi_triple_add: handleTripleAdd,\n\tmnemopi_triple_query: handleTripleQuery,\n\tmnemopi_scratchpad_write: handleScratchpadWrite,\n\tmnemopi_scratchpad_read: handleScratchpadRead,\n\tmnemopi_scratchpad_clear: handleScratchpadClear,\n\tmnemopi_export: handleExport,\n\tmnemopi_update: handleUpdate,\n\tmnemopi_forget: handleForget,\n\tmnemopi_import: handleImport,\n\tmnemopi_diagnose: handleDiagnose,\n\tmnemopi_graph_query: handleGraphQuery,\n\tmnemopi_graph_link: handleGraphLink,\n};\n\nexport async function handleToolCall(name: string, args: ToolArguments = {}): Promise<ToolResult> {\n\tconst handler = TOOL_HANDLERS[name];\n\tif (handler === undefined) throw new Error(`Unknown tool: ${name}`);\n\treturn handler(args);\n}\nexport function getToolDefinitions(): readonly ToolDefinition[] {\n\treturn TOOLS;\n}\n","sourceCodeStart":947,"sourceCodeEnd":971,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/mnemopi/src/mcp-tools.ts#L947-L971","documentation":"handleToolCall() dispatches MCP tool invocations through the TOOL_HANDLERS lookup table. If the requested tool name is not a registered mnemopi_* handler, it throws this error naming the unknown tool. Only tools listed in TOOLS/getToolDefinitions() are valid.","triggerScenarios":"Calling handleToolCall('some_tool') where 'some_tool' is not a key in TOOL_HANDLERS — e.g. a typo, a tool from a different MCP server, or a client using a stale tool list.","commonSituations":"LLM clients hallucinating tool names, cached tool lists from an older/newer server version, tools renamed between releases, or calling tools from another MCP server through this one.","solutions":["Call getToolDefinitions() (or tools/list over MCP) and use exactly one of the returned names.","Fix the tool name typo in the client/config; names are mnemopi_graph_query, mnemopi_graph_link, etc.","Refresh the client's cached tool list so it matches the running server version.","If a needed tool is genuinely missing, add a handler to TOOL_HANDLERS and a definition to TOOLS."],"exampleFix":"// before\nconst result = await handleToolCall('mnemopi_graph_search', args); // wrong name\n// after\nconst names = getToolDefinitions().map(t => t.name);\nif (!names.includes('mnemopi_graph_query')) throw new Error('tool unavailable');\nconst result = await handleToolCall('mnemopi_graph_query', args);","handlingStrategy":"validation","validationCode":"import { getToolDefinitions, handleToolCall } from './mcp-tools';\nconst knownTools = new Set(getToolDefinitions().map(t => t.name));\nasync function safeToolCall(name, args) {\n  if (!knownTools.has(name)) {\n    throw new Error(`Tool '${name}' not available. Valid: ${[...knownTools].join(', ')}`);\n  }\n  return handleToolCall(name, args);\n}","typeGuard":"function isKnownTool(name) {\n  return TOOL_HANDLERS[name] !== undefined;\n}","tryCatchPattern":"try {\n  const result = await handleToolCall(name, args);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Unknown tool:')) {\n    const available = getToolDefinitions().map(t => t.name);\n    return { error: { code: -32601, message: `${err.message} Available: ${available.join(', ')}` } };\n  }\n  throw err;\n}","preventionTips":["Fetch tools/list (getToolDefinitions) at session start instead of hard-coding names","Refresh the tool cache whenever the server version changes","Validate tool names against the definitions before dispatching","Return JSON-RPC -32601 (method not found) style errors to LLM clients so they self-correct"],"tags":["mcp","tool-call","unknown-tool","api-mismatch"],"backgroundTag":"unknown-tool","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}