rohitg00/agentmemory · error · Error
Unknown method: ${method}
Error message
Unknown method: ${method} What it means
The standalone MCP server's JSON-RPC message handler switches on the `method` field of incoming requests (initialize, tools/list, tools/call, etc.) and throws this for any method it does not implement. It is thrown synchronously out of the transport callback, so the client sees a protocol-level failure rather than a JSON-RPC error response with a proper code.
Source
Thrown at src/mcp/standalone.ts:512
const toolName = params.name as string;
const toolArgs = (params.arguments as Record<string, unknown>) || {};
try {
return await handleToolCall(toolName, toolArgs);
} catch (err) {
return {
content: [
{
type: "text",
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
},
],
isError: true,
};
}
}
default:
throw new Error(`Unknown method: ${method}`);
}
});
process.stderr.write(
`[@agentmemory/mcp] Standalone MCP server v${SERVER_INFO.version} starting...\n`,
);
transport.start();
process.on("SIGINT", () => {
kv.persist();
process.exit(0);
});
process.on("SIGTERM", () => {
kv.persist();
process.exit(0);
});
View on GitHub (pinned to e04ba88819)
Solutions
- Only send methods this server implements: initialize, tools/list, tools/call (see the switch ending at standalone.ts:512).
- Disable/disable-negotiate resources and prompts in the client for this server, or use the full agentmemory MCP server which supports them.
- Check the exact method string casing/spelling in your JSON-RPC payload.
- If you need the method, add a case to the transport switch in src/mcp/standalone.ts.
Example fix
// before
{ "jsonrpc": "2.0", "id": 2, "method": "resources/list" }
// after
{ "jsonrpc": "2.0", "id": 2, "method": "tools/list" } Defensive patterns
Strategy: try-catch
Validate before calling
const IMPLEMENTED_METHODS = new Set(["initialize", "tools/list", "tools/call"]);
function assertSupportedMethod(method: string) {
if (!IMPLEMENTED_METHODS.has(method)) throw new Error(`Method "${method}" not implemented by standalone server`);
} Type guard
function isImplementedMethod(m: string): m is "initialize" | "tools/list" | "tools/call" {
return m === "initialize" || m === "tools/list" || m === "tools/call";
} Try / catch
try {
await rpc(method, params);
} catch (e) {
if (e instanceof Error && e.message.startsWith("Unknown method:")) {
console.warn(`${method} unsupported; skipping`); // degrade to no-op
} else throw e;
} Prevention
- During initialize, only enable the capabilities this server actually implements (tools only, not resources/prompts).
- Guard client features (resource browsing, prompt listing) behind capability negotiation results.
- Copy method strings from the MCP spec/client SDK constants, never by hand.
- Test your JSON-RPC payloads against the standalone server before wiring clients.
When it happens
Trigger: Sending a JSON-RPC request whose `method` is not one of the handled cases — e.g. `resources/list`, `prompts/list`, `ping`, or a notifications/... method when the client expects the standalone bundle to support it, or a misspelled method name.
Common situations: A generic MCP client negotiates capabilities (resources, prompts, sampling) that this minimal standalone server doesn't implement; hand-crafted curl/WebSocket JSON-RPC payloads with wrong method strings; protocol version drift where newer clients call methods this server predates.
Related errors
- mem::search: token_budget must be a positive integer
- Unknown tool: ${toolName}
- content is required
- query is required
- memoryIds is required
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/9f3a934900111101.
Report an issue: GitHub.