can1357/oh-my-pi · error · Error
Unknown tool: ${name}
Error message
Unknown tool: ${name} What it means
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.
Source
Thrown at packages/mnemopi/src/mcp-tools.ts:965
mnemopi_validate: handleValidate,
mnemopi_get: handleGet,
mnemopi_triple_add: handleTripleAdd,
mnemopi_triple_query: handleTripleQuery,
mnemopi_scratchpad_write: handleScratchpadWrite,
mnemopi_scratchpad_read: handleScratchpadRead,
mnemopi_scratchpad_clear: handleScratchpadClear,
mnemopi_export: handleExport,
mnemopi_update: handleUpdate,
mnemopi_forget: handleForget,
mnemopi_import: handleImport,
mnemopi_diagnose: handleDiagnose,
mnemopi_graph_query: handleGraphQuery,
mnemopi_graph_link: handleGraphLink,
};
export async function handleToolCall(name: string, args: ToolArguments = {}): Promise<ToolResult> {
const handler = TOOL_HANDLERS[name];
if (handler === undefined) throw new Error(`Unknown tool: ${name}`);
return handler(args);
}
export function getToolDefinitions(): readonly ToolDefinition[] {
return TOOLS;
}
View on GitHub (pinned to 9690622007)
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.
Example fix
// before
const result = await handleToolCall('mnemopi_graph_search', args); // wrong name
// after
const names = getToolDefinitions().map(t => t.name);
if (!names.includes('mnemopi_graph_query')) throw new Error('tool unavailable');
const result = await handleToolCall('mnemopi_graph_query', args); Defensive patterns
Strategy: validation
Validate before calling
import { getToolDefinitions, handleToolCall } from './mcp-tools';
const knownTools = new Set(getToolDefinitions().map(t => t.name));
async function safeToolCall(name, args) {
if (!knownTools.has(name)) {
throw new Error(`Tool '${name}' not available. Valid: ${[...knownTools].join(', ')}`);
}
return handleToolCall(name, args);
} Type guard
function isKnownTool(name) {
return TOOL_HANDLERS[name] !== undefined;
} Try / catch
try {
const result = await handleToolCall(name, args);
} catch (err) {
if (err instanceof Error && err.message.startsWith('Unknown tool:')) {
const available = getToolDefinitions().map(t => t.name);
return { error: { code: -32601, message: `${err.message} Available: ${available.join(', ')}` } };
}
throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Received toolcall_delta for non-toolCall content
- Anthropic SDK request did not expose a stream response
- Anthropic cache refresh request did not expose a raw respons
- ENXIO
- Refusing to download onto a non-regular file: ${absolutePath
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/b72ab414995dc362.
Report an issue: GitHub.