{"record":{"id":"79fb2fe311e50ab6","repo":"rohitg00/ai-engineering-from-scratch","slug":"modern-result-is-missing-resulttype","errorCode":null,"errorMessage":"modern result is missing resultType","messagePattern":"modern result is missing 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":247,"sourceCode":"        allowed.update(EXTENSION_RESULT_TYPES.get(capability, set()))\n    return allowed\n\n\ndef validate_result(\n    result: dict[str, Any],\n    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()","sourceCodeStart":229,"sourceCodeEnd":265,"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#L229-L265","documentation":"Error \"modern result is missing resultType\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/13-tools-and-protocols/31-mcp-conformance-versioning-and-operations/code/main.py:247 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"}