rohitg00/agentmemory · error · Error
Unknown tool: ${v.tool}
Error message
Unknown tool: ${v.tool} What it means
The standalone MCP server's proxy handler `handleProxy` dispatches a validated tool call through a switch on the tool name and throws this error when no case matches. It means the MCP client requested a tool that is neither one of the proxy-backed tools nor handled locally. It guards against invoking tool names that were never registered, including typos and tools removed in newer versions.
Source
Thrown at src/mcp/standalone.ts:255
const result = await handle.call("/agentmemory/governance/memories", {
method: "DELETE",
body: JSON.stringify({ memoryIds: v.memoryIds, reason: v.reason }),
});
return textResponse(result);
}
case "memory_export": {
const result = await handle.call("/agentmemory/export", { method: "GET" });
return textResponse(result, true);
}
case "memory_audit": {
const result = await handle.call(
`/agentmemory/audit?limit=${v.limit}`,
{ method: "GET" },
);
return textResponse(result, true);
}
default:
throw new Error(`Unknown tool: ${v.tool}`);
}
}
async function handleLocal(
v: Validated,
kvInstance: InMemoryKV,
): Promise<{ content: Array<{ type: string; text: string }> }> {
switch (v.tool) {
case "memory_save": {
const id = generateId("mem");
const isoNow = new Date().toISOString();
await kvInstance.set("mem:memories", id, {
id,
type: v.type,
title: (v.content || "").slice(0, 80),
content: v.content,
concepts: v.concepts,
files: v.files,View on GitHub (pinned to e04ba88819)
Solutions
- Call `tools/list` (or inspect handleProxy's switch in src/mcp/standalone.ts) to get the exact supported tool names and correct the caller.
- Fix typos in the tool name — names are exact-match, case-sensitive strings like `memory_save`.
- Update the @agentmemory MCP server to a version matching your client's tool list, or downgrade the client.
- If you need a tool that genuinely doesn't exist, implement it in handleProxy or run the full agentmemory server instead of the standalone bundle.
Example fix
// before
await callTool("memory_search_all", { query: "x" });
// after
// use a real tool name from tools/list, e.g.:
await callTool("memory_recall", { query: "x" }); Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(["memory_save", "memory_recall", "memory_search" /* ...from tools/list */]);
function assertKnownTool(tool: string) {
if (!SUPPORTED.has(tool)) throw new Error(`Tool "${tool}" not supported by this server; call tools/list`);
} Type guard
function isKnownTool(tool: string, known: readonly string[]): tool is typeof known[number] {
return (known as readonly string[]).includes(tool);
} Try / catch
try {
return await callTool(toolName, args);
} catch (e) {
if (e instanceof Error && e.message.startsWith("Unknown tool:")) {
const list = await callTool("tools/list"); // or handle tools/list request
throw new Error(`Unknown tool "${toolName}". Available: ${JSON.stringify(list)}`);
}
throw e;
} Prevention
- Always discover tool names via tools/list instead of hardcoding them.
- Keep the MCP client package version in lockstep with the server version.
- Constrain LLM agents to the advertised tool list in their system prompt.
- Add an integration test that calls every tool name you rely on.
When it happens
Trigger: Calling an MCP tool via `mcp::tools::call` (or tools/call over the MCP transport) whose name is in the validated set but has no `case` in handleProxy's switch — e.g. a typo like `memory_retrive`, a tool from a newer agentmemory release than the server, or a custom tool name invented by the caller.
Common situations: An LLM agent hallucinates a plausible tool name; a client hardcodes tool names after an upgrade where tools were renamed; calling the proxy path with a tool that only exists in the full server, while the standalone bundle only wired a subset into handleProxy.
Related errors
- Unknown tool: ${toolName} (local fallback supports only ${[.
- mem::search: token_budget must be a positive integer
- Unknown tool: ${toolName}
- content is required
- query is required
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/ee10dc79b9b2575b.
Report an issue: GitHub.