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

unknown or unadvertised resultType: {result_type}

Error message

unknown or unadvertised resultType: {result_type}

What it means

Error "unknown or unadvertised resultType: {result_type}" thrown in rohitg00/ai-engineering-from-scratch.

Source

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

    era: str,
    capabilities: set[str] | None = None,
) -> dict[str, Any]:
    if not isinstance(result, dict):
        raise ProtocolViolation("result must be an object")
    preserved = dict(result)
    result_type = result.get("resultType")
    if era == "legacy":
        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")

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:253 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/06b4845bc630a013. Report an issue: GitHub.