rohitg00/ai-engineering-from-scratch · error · RpcFault

-32601

-32601

Error message

Method not found: {method}

What it means

Error "Method not found: {method}" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/13-tools-and-protocols/09-mcp-transports/code/main.py:290

        elif method == "tools/call":
            if params.get("name") != "ping" or not isinstance(params.get("arguments", {}), dict):
                result = complete(
                    {
                        "content": [{"type": "text", "text": "Unknown or invalid tool"}],
                        "isError": True,
                    }
                )
            else:
                result = complete(
                    {"content": [{"type": "text", "text": "pong"}], "isError": False}
                )
        elif method == "subscriptions/listen":
            notifications = params.get("notifications")
            if not isinstance(notifications, dict):
                raise RpcFault(-32602, "subscriptions/listen requires notifications")
            result = complete({})
        else:
            raise RpcFault(-32601, f"Method not found: {method}")
        return {"jsonrpc": "2.0", "id": request_id, "result": result}
    except RpcFault as exc:
        return rpc_error(request_id, exc.code, str(exc), exc.data)


def accepted_filter(requested: dict[str, Any]) -> dict[str, Any]:
    accepted: dict[str, Any] = {}
    for key in ("toolsListChanged", "promptsListChanged", "resourcesListChanged"):
        if requested.get(key) is True:
            accepted[key] = True
    resources = requested.get("resourceSubscriptions")
    if isinstance(resources, list) and all(isinstance(uri, str) for uri in resources):
        accepted["resourceSubscriptions"] = resources.copy()
    return accepted


def subscription_messages(message: dict[str, Any]) -> list[dict[str, Any]]:
    request_id = message["id"]

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/09-mcp-transports/code/main.py:290 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/a6bf9712e751bb59. Report an issue: GitHub.