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

tools/list must return a complete result

Error message

tools/list must return a complete result

What it means

Error "tools/list must return a complete result" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:261

        if result_type is None:
            return {"semanticType": "complete", "wire": preserved, "inferred": True}
    elif era == "modern":
        if result_type is None:
            raise ProtocolViolation("modern result is missing resultType")
    else:
        raise ValueError(f"unknown era: {era}")

    allowed = allowed_result_types(capabilities or set())
    if result_type not in allowed:
        raise ProtocolViolation(f"unknown or unadvertised resultType: {result_type}")
    return {"semanticType": result_type, "wire": preserved, "inferred": False}


def validate_method_result(method: str, result: dict[str, Any]) -> None:
    result_type = result.get("resultType")
    if method == "tools/list":
        if result_type != "complete":
            raise ProtocolViolation("tools/list must return a complete result")
        tools = result.get("tools")
        if not isinstance(tools, list):
            raise ProtocolViolation("complete tools/list result requires a tools array")
        names: set[str] = set()
        for tool in tools:
            if not isinstance(tool, dict):
                raise ProtocolViolation("each tools/list descriptor must be an object")
            name = tool.get("name")
            description = tool.get("description")
            input_schema = tool.get("inputSchema")
            if not isinstance(name, str) or not name:
                raise ProtocolViolation("each tool descriptor requires a non-empty name")
            if name in names:
                raise ProtocolViolation("tools/list contains a duplicate tool name")
            names.add(name)
            if not isinstance(description, str) or not description:
                raise ProtocolViolation("each tool descriptor requires a non-empty description")
            if not isinstance(input_schema, dict) or input_schema.get("type") != "object":

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:261 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/abe4ba48c769bb36. Report an issue: GitHub.