{"record":{"id":"54e30e865f35dfd5","repo":"rohitg00/agentmemory","slug":"unknown-tool-toolname","errorCode":null,"errorMessage":"Unknown tool: ${toolName}","messagePattern":"Unknown tool: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mcp/standalone.ts","lineNumber":120,"sourceCode":"interface Validated {\n  tool: string;\n  content?: string;\n  type?: string;\n  concepts?: string[];\n  files?: string[];\n  project?: string;\n  agentId?: string;\n  query?: string;\n  limit?: number;\n  format?: string;\n  tokenBudget?: number;\n  memoryIds?: string[];\n  reason?: string;\n}\n\nfunction validate(toolName: string, args: Record<string, unknown>): Validated {\n  if (!IMPLEMENTED_TOOLS.has(toolName)) {\n    throw new Error(`Unknown tool: ${toolName}`);\n  }\n  const v: Validated = { tool: toolName };\n  switch (toolName) {\n    case \"memory_save\": {\n      const content = args[\"content\"];\n      if (typeof content !== \"string\" || !content.trim()) {\n        throw new Error(\"content is required\");\n      }\n      v.content = content;\n      v.type = (args[\"type\"] as string) || \"fact\";\n      v.concepts = normalizeList(args[\"concepts\"]);\n      v.files = normalizeList(args[\"files\"]);\n      // The tool schema exposes project (and now agentId); dropping them\n      // here silently broke project/agent scoping through the stdio\n      // package specifically.\n      if (typeof args[\"project\"] === \"string\" && args[\"project\"].trim()) {\n        v.project = args[\"project\"].trim();\n      }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/mcp/standalone.ts#L102-L138","documentation":"The standalone MCP server validates incoming tool calls against the IMPLEMENTED_TOOLS set before argument parsing. A tool name outside that set throws this error, distinguishing unimplemented/typo'd tool names from per-tool argument errors.","triggerScenarios":"An MCP client invoking a tool whose name is not in IMPLEMENTED_TOOLS — a typo (e.g. memory_serch), a tool from a newer/older plugin version than the running standalone server, or AGENTMEMORY_TOOLS visibility filtering excluding the tool the client believes exists.","commonSituations":"Plugin config listing tools the standalone build doesn't implement, stale cached tool lists in the MCP client after an upgrade, hand-written tool-call scripts with wrong names, default visible-tool subset (8 tools) hiding tools behind AGENTMEMORY_TOOLS=all.","solutions":["Check the exact tool name against the tools advertised by the server (list tools via the MCP client).","Set AGENTMEMORY_TOOLS=all on the server if the tool exists but is hidden by the default subset.","Upgrade the standalone server / plugin to matching versions.","Fix typos in hand-written calls; use snake_case names like memory_save."],"exampleFix":"// before\nawait callTool(\"memory_search_all\", { query: \"x\" }); // unknown\n// after\nawait callTool(\"memory_smart_search\", { query: \"x\" });","handlingStrategy":"validation","validationCode":"const KNOWN = new Set([\"memory_save\", \"memory_search\", \"memory_recall\", \"memory_smart_search\", \"memory_sessions\", \"memory_governance_delete\", \"memory_export\", \"memory_audit\"]);\nif (!KNOWN.has(toolName)) throw new Error(`refusing to call unknown tool: ${toolName}`);","typeGuard":"function isKnownTool(name: string): name is KnownTool {\n  return KNOWN_TOOLS.includes(name as KnownTool);\n}","tryCatchPattern":"try {\n  return await callTool(toolName, args);\n} catch (e) {\n  if (String(e.message).startsWith(\"Unknown tool:\")) {\n    const tools = await listServerTools(); // resync client list\n    throw new Error(`${toolName} not available; server offers: ${tools.join(\", \")}`);\n  }\n  throw e;\n}","preventionTips":["Discover tools dynamically via the MCP list-tools endpoint instead of hardcoding names.","Keep plugin and standalone server versions in lockstep.","Set AGENTMEMORY_TOOLS=all if your workflow needs non-default tools."],"tags":["mcp","validation","tool-name"],"backgroundTag":"unknown-tool-name","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}