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/08-building-an-mcp-client/code/main.py:215

                declared = {tool["name"] for tool in self.tools}
                result = complete(
                    self.server_info,
                    {
                        "content": [
                            {
                                "type": "text",
                                "text": (
                                    f"[{self.server_info['name']}] {name} ran"
                                    if name in declared
                                    else f"Unknown tool: {name}"
                                ),
                            }
                        ],
                        "isError": name not in declared,
                    },
                )
            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)


class LegacyFakeServer:
    def __init__(self, name: str, tools: list[dict[str, Any]]) -> None:
        self.name = name
        self.tools = sorted(tools, key=lambda tool: tool["name"])
        self.initialized = False
        self.received: list[dict[str, Any]] = []
        self.timeouts_ms: list[int | None] = []

    def __call__(
        self,
        message: dict[str, Any],
        timeout_ms: int | None = None,
    ) -> dict[str, Any] | None:

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/08-building-an-mcp-client/code/main.py:215 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/ab46a7d673cffec6. Report an issue: GitHub.