{"record":{"id":"bcb97b747849e591","repo":"googleapis/mcp-toolbox","slug":"method-not-found-bcb97b","errorCode":"METHOD_NOT_FOUND","errorMessage":"invalid method %s","messagePattern":"invalid method (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/mcp/v20250326/method.go","lineNumber":57,"sourceCode":")\n\n// ProcessMethod returns a response for the request.\nfunc ProcessMethod(ctx context.Context, id jsonrpc.RequestId, method string, g group.Group, primitiveMgr *primitives.PrimitiveManager, body []byte, header http.Header) (any, error) {\n\tswitch method {\n\tcase INITIALIZE:\n\t\treturn initializeHandler(ctx, id, body)\n\tcase PING:\n\t\treturn pingHandler(id)\n\tcase TOOLS_LIST:\n\t\treturn toolsListHandler(ctx, id, primitiveMgr, g, body)\n\tcase TOOLS_CALL:\n\t\treturn toolsCallHandler(ctx, id, g, primitiveMgr, body, header)\n\tcase PROMPTS_LIST:\n\t\treturn promptsListHandler(ctx, id, primitiveMgr, g, body)\n\tcase PROMPTS_GET:\n\t\treturn promptsGetHandler(ctx, id, g, primitiveMgr, body)\n\tdefault:\n\t\terr := fmt.Errorf(\"invalid method %s\", method)\n\t\treturn jsonrpc.NewError(id, jsonrpc.METHOD_NOT_FOUND, err.Error(), nil), err\n\t}\n}\n\n// InitializeResponse runs capability negotiation and protocol version agreement.\n// This is the Initialization phase of the lifecycle for MCP client-server connections.\n// Always start with the latest protocol version supported.\nfunc initializeHandler(ctx context.Context, id jsonrpc.RequestId, body []byte) (any, error) {\n\tv, err := util.ToolboxVersionFromContext(ctx)\n\tif err != nil {\n\t\treturn jsonrpc.NewError(id, jsonrpc.INTERNAL_ERROR, err.Error(), nil), err\n\t}\n\n\tvar req InitializeRequest\n\tif err := json.Unmarshal(body, &req); err != nil {\n\t\terr = fmt.Errorf(\"invalid mcp initialize request: %w\", err)\n\t\treturn jsonrpc.NewError(id, jsonrpc.INVALID_REQUEST, err.Error(), nil), err\n\t}","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp/v20250326/method.go#L39-L75","documentation":"ProcessMethod dispatches incoming MCP JSON-RPC requests by method name. This METHOD_NOT_FOUND error is returned when the method string does not match any handler for the 2025-03-26 protocol version (initialize, tools/list, tools/call, prompts/list, prompts/get, etc.), usually meaning the client sent a method this server version does not implement.","triggerScenarios":"A JSON-RPC request whose method field is misspelled, unsupported (e.g. resources/list, logging/setLevel), or belongs to a newer MCP protocol version routed to the v20250326 handler.","commonSituations":"MCP clients negotiating an older protocol version then calling newer-version methods; typos in custom client code; clients assuming features (resources, sampling) the server doesn't support.","solutions":["Use a supported method name: initialize, tools/list, tools/call, prompts/list, prompts/get (plus notifications the version allows)","Negotiate the correct protocolVersion in the initialize request so requests route to the right handler","Check client spelling/casing of the method string","Upgrade the server if the method requires a newer MCP protocol version"],"exampleFix":"// before\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/listAll\"}\n// after\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}","handlingStrategy":"validation","validationCode":"const supported = [\"initialize\",\"notifications/initialized\",\"tools/list\",\"tools/call\",\"prompts/list\",\"prompts/get\"]\nif !supported.includes(request.method) {\n    throw new Error(`method ${request.method} not supported by this server version`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the client to the negotiated protocolVersion and use only its methods","Check the server version's supported method list before calling new methods","Handle METHOD_NOT_FOUND by falling back to older method names where possible"],"tags":["go","mcp","jsonrpc","method-not-found"],"backgroundTag":"jsonrpc-method-not-found","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}