{"record":{"id":"9f3a934900111101","repo":"rohitg00/agentmemory","slug":"unknown-method-method","errorCode":null,"errorMessage":"Unknown method: ${method}","messagePattern":"Unknown method: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mcp/standalone.ts","lineNumber":512,"sourceCode":"      const toolName = params.name as string;\n      const toolArgs = (params.arguments as Record<string, unknown>) || {};\n      try {\n        return await handleToolCall(toolName, toolArgs);\n      } catch (err) {\n        return {\n          content: [\n            {\n              type: \"text\",\n              text: `Error: ${err instanceof Error ? err.message : String(err)}`,\n            },\n          ],\n          isError: true,\n        };\n      }\n    }\n\n    default:\n      throw new Error(`Unknown method: ${method}`);\n  }\n});\n\nprocess.stderr.write(\n  `[@agentmemory/mcp] Standalone MCP server v${SERVER_INFO.version} starting...\\n`,\n);\ntransport.start();\n\nprocess.on(\"SIGINT\", () => {\n  kv.persist();\n  process.exit(0);\n});\nprocess.on(\"SIGTERM\", () => {\n  kv.persist();\n  process.exit(0);\n});\n","sourceCodeStart":494,"sourceCodeEnd":529,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/mcp/standalone.ts#L494-L529","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n{ \"jsonrpc\": \"2.0\", \"id\": 2, \"method\": \"resources/list\" }\n// after\n{ \"jsonrpc\": \"2.0\", \"id\": 2, \"method\": \"tools/list\" }","handlingStrategy":"try-catch","validationCode":"const IMPLEMENTED_METHODS = new Set([\"initialize\", \"tools/list\", \"tools/call\"]);\nfunction assertSupportedMethod(method: string) {\n  if (!IMPLEMENTED_METHODS.has(method)) throw new Error(`Method \"${method}\" not implemented by standalone server`);\n}","typeGuard":"function isImplementedMethod(m: string): m is \"initialize\" | \"tools/list\" | \"tools/call\" {\n  return m === \"initialize\" || m === \"tools/list\" || m === \"tools/call\";\n}","tryCatchPattern":"try {\n  await rpc(method, params);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Unknown method:\")) {\n    console.warn(`${method} unsupported; skipping`); // degrade to no-op\n  } else throw e;\n}","preventionTips":["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."],"tags":["mcp","json-rpc","unknown-method","protocol"],"backgroundTag":"unknown-rpc-method","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}