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

-32601

-32601

Error message

Method not found: {message['method']}

What it means

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

Source

Thrown at phases/13-tools-and-protocols/07-building-an-mcp-server/code/main.py:350

    "prompts/list": handle_prompts_list,
    "resources/list": handle_resources_list,
    "resources/read": handle_resources_read,
    "server/discover": handle_discover,
    "tools/call": handle_tools_call,
    "tools/list": handle_tools_list,
}


def dispatch(message: dict[str, Any]) -> dict[str, Any] | None:
    if "id" not in message:
        return None
    request_id = message.get("id")
    error_id = request_id if type(request_id) in (int, str) else None
    try:
        validate_request(message)
        handler = HANDLERS.get(message["method"])
        if handler is None:
            raise RpcProblem(-32601, f"Method not found: {message['method']}")
        result = handler(message["params"])
        return {"jsonrpc": "2.0", "id": request_id, "result": result}
    except RpcProblem as exc:
        return rpc_error(error_id, exc.code, str(exc), exc.data)
    except Exception as exc:
        return rpc_error(error_id, -32603, "Internal error", {"detail": str(exc)})


def serve_stdio() -> None:
    for raw_line in sys.stdin:
        line = raw_line.strip()
        if not line:
            continue
        try:
            parsed = json.loads(line)
        except json.JSONDecodeError as exc:
            response = rpc_error(None, -32700, "Parse error", {"detail": str(exc)})
        else:

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/07-building-an-mcp-server/code/main.py:350 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/0ea2cd961465451c. Report an issue: GitHub.