{"record":{"id":"06b4845bc630a013","repo":"rohitg00/ai-engineering-from-scratch","slug":"unknown-or-unadvertised-resulttype-result-type","errorCode":null,"errorMessage":"unknown or unadvertised resultType: {result_type}","messagePattern":"unknown or unadvertised resultType: (.+?)","errorType":"exception","errorClass":"ProtocolViolation","httpStatus":null,"severity":"error","filePath":"phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py","lineNumber":253,"sourceCode":"    era: str,\n    capabilities: set[str] | None = None,\n) -> dict[str, Any]:\n    if not isinstance(result, dict):\n        raise ProtocolViolation(\"result must be an object\")\n    preserved = dict(result)\n    result_type = result.get(\"resultType\")\n    if era == \"legacy\":\n        if result_type is None:\n            return {\"semanticType\": \"complete\", \"wire\": preserved, \"inferred\": True}\n    elif era == \"modern\":\n        if result_type is None:\n            raise ProtocolViolation(\"modern result is missing resultType\")\n    else:\n        raise ValueError(f\"unknown era: {era}\")\n\n    allowed = allowed_result_types(capabilities or set())\n    if result_type not in allowed:\n        raise ProtocolViolation(f\"unknown or unadvertised resultType: {result_type}\")\n    return {\"semanticType\": result_type, \"wire\": preserved, \"inferred\": False}\n\n\ndef validate_method_result(method: str, result: dict[str, Any]) -> None:\n    result_type = result.get(\"resultType\")\n    if method == \"tools/list\":\n        if result_type != \"complete\":\n            raise ProtocolViolation(\"tools/list must return a complete result\")\n        tools = result.get(\"tools\")\n        if not isinstance(tools, list):\n            raise ProtocolViolation(\"complete tools/list result requires a tools array\")\n        names: set[str] = set()\n        for tool in tools:\n            if not isinstance(tool, dict):\n                raise ProtocolViolation(\"each tools/list descriptor must be an object\")\n            name = tool.get(\"name\")\n            description = tool.get(\"description\")\n            input_schema = tool.get(\"inputSchema\")","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py#L235-L271","documentation":"Error \"unknown or unadvertised resultType: {result_type}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:253 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}