{"record":{"id":"0af9ec5430924b3c","repo":"rohitg00/ai-engineering-from-scratch","slug":"expected-input-required-result","errorCode":null,"errorMessage":"expected input_required result","messagePattern":"expected input_required result","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py","lineNumber":551,"sourceCode":"        params: dict[str, Any] | None = None,\n        *,\n        server: MCPServer | None = None,\n    ) -> dict[str, Any]:\n        _request, result = self.send(method, params, server=server)\n        return result\n\n    def call_with_mrtr(\n        self,\n        params: dict[str, Any],\n        *,\n        first_server: MCPServer,\n        retry_server: MCPServer,\n    ) -> dict[str, Any]:\n        first_request, input_required = self.send(\n            \"tools/call\", params, server=first_server\n        )\n        if input_required.get(\"resultType\") != \"input_required\":\n            raise RuntimeError(\"expected input_required result\")\n        responses = self.fulfill(input_required[\"inputRequests\"])\n        retry_params = {\n            **params,\n            \"inputResponses\": responses,\n            \"requestState\": input_required[\"requestState\"],\n        }\n        retry_request, complete = self.send(\n            \"tools/call\", retry_params, server=retry_server\n        )\n        return {\n            \"initialRequestId\": first_request[\"id\"],\n            \"retryRequestId\": retry_request[\"id\"],\n            \"inputRequired\": input_required,\n            \"complete\": complete,\n        }\n\n    @staticmethod\n    def fulfill(input_requests: dict[str, Any]) -> dict[str, Any]:","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py#L533-L569","documentation":"Raised in call_with_mrtr when the first server's tools/call reply lacks resultType == 'input_required'. The MRTR flow depends on the first instance pausing for more input; any other result (success, error, wrong stop reason) means the flow cannot continue to the retry-server stage.","triggerScenarios":"Thrown at certifications/claude/lessons/11-mcp-server-design-and-integration/code/main.py:551 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the first MCPServer is configured to return an input_required elicit result for the tool being called","Check the tool's halt-on-input configuration so it stops and returns requestState instead of completing","Ensure the response parsing preserves resultType rather than stripping it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}