thedotmack/claude-mem · error

Unknown tool

Error message

Unknown tool: ${request.params.name}

What it means

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.

Solutions

  1. Call `tools/list` to fetch the current tool names and use an exact match.
  2. Fix the tool name spelling in the client/LLM prompt.
  3. Restart the client so it refreshes its cached tool list after server changes.
  4. Confirm you are connected to the intended MCP server that registers this tool.

Example fix

// before
await client.callTool({ name: 'query_corpus_by_name', arguments: {...} });
// after
await client.callTool({ name: 'query_corpus', arguments: { name: 'notes', question: '...' } });
Defensive patterns

Strategy: validation

Validate before calling

const toolNames = (await client.listTools()).tools.map(t => t.name);
if (!toolNames.includes('query_corpus')) throw new Error(`Tool not available; have: ${toolNames.join(', ')}`);

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/a55496b07a61a089. Report an issue: GitHub.

Appendix: source

Thrown at src/servers/mcp-server.ts:945

  }
);

server.setRequestHandler(ListToolsRequestSchema, async () => {
  const advertisedTools = getAdvertisedMcpToolsForRuntime(tools, selectRuntime());
  return {
    tools: advertisedTools.map(tool => ({
      name: tool.name,
      description: tool.description,
      inputSchema: tool.inputSchema
    }))
  };
});

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const tool = tools.find(t => t.name === request.params.name);

  if (!tool) {
    throw new Error(`Unknown tool: ${request.params.name}`);
  }

  try {
    return await tool.handler(request.params.arguments || {});
  } catch (error: unknown) {
    logger.error('SYSTEM', 'Tool execution failed', { tool: request.params.name }, error instanceof Error ? error : new Error(String(error)));
    return {
      content: [{
        type: 'text' as const,
        text: `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`
      }],
      isError: true
    };
  }
});

const HEARTBEAT_INTERVAL_MS = 30_000;
let heartbeatTimer: ReturnType<typeof setInterval> | null = null;

View on GitHub (pinned to d8bc9755e7)