{"record":{"id":"238d223b5c0078f4","repo":"iflytek/astron-agent","slug":"mcp-tool-call-failed-tool-errortype","errorCode":null,"errorMessage":"MCP tool call failed, tool={}, errorType={}","messagePattern":"MCP tool call failed, tool=(.+?), errorType=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/springai/McpToolCallbackFactory.java","lineNumber":74,"sourceCode":"        @Override\n        public String call(String toolInput) {\n            log.info(\"mcp tool invoked, tool={}\", tool.toolName());\n            JSONObject args;\n            try {\n                args = StringUtils.isBlank(toolInput) ? new JSONObject() : JSON.parseObject(toolInput);\n            } catch (Exception e) {\n                log.warn(\n                        \"Failed to parse MCP tool input as JSON, tool={}, inputBytes={}, errorType={}\",\n                        tool.toolName(),\n                        toolInput == null ? 0 : toolInput.getBytes(StandardCharsets.UTF_8).length,\n                        e.getClass().getSimpleName());\n                args = new JSONObject();\n            }\n            String content;\n            try {\n                content = mcpRuntimeToolService.callTool(tool, args);\n            } catch (IOException e) {\n                log.warn(\n                        \"MCP tool call failed, tool={}, errorType={}\",\n                        tool.toolName(),\n                        e.getClass().getSimpleName());\n                content = \"MCP tool call failed.\";\n            }\n            context.addTrace(new JSONObject()\n                    .fluentPut(\"type\", \"mcp\")\n                    .fluentPut(\"deskToolName\", \"MCP: \" + tool.toolName())\n                    .fluentPut(\"toolName\", tool.toolName())\n                    .fluentPut(\"arguments\", args)\n                    .fluentPut(\"content\", StringUtils.abbreviate(content, 2000)));\n            return content;\n        }\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":90,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/springai/McpToolCallbackFactory.java#L56-L90","documentation":"McpToolCallbackFactory.call invokes a remote MCP runtime tool via mcpRuntimeToolService.callTool, which performs I/O. If that call throws IOException (network failure, connection refused, stream error), the factory logs a warning with the exception's simple class name and returns fallback content 'MCP tool call failed.' to the model instead of propagating the failure.","triggerScenarios":"The MCP runtime service is down or unreachable, the socket is reset mid-call, the HTTP connection times out at the transport level, or the plugin network is blocked (firewall/DNS failure) while an agent chat step invokes an MCP tool.","commonSituations":"MCP runtime pod crashed or redeploying; wrong MCP service URL/port in configuration; Kubernetes network policy blocking hub->plugin traffic; transient network partition during a chat session.","solutions":["Check MCP runtime service health and restart it if down","Verify the MCP runtime endpoint URL/port configured in hub matches the deployed service","Test network connectivity from the hub pod to the MCP runtime (DNS, network policies)","Retry the chat/tool call — the failure may be transient; investigate repeated occurrences"],"exampleFix":"null","handlingStrategy":"fallback","validationCode":"// health-check the MCP runtime before tool dispatch\nboolean up = mcpRuntimeHealthIndicator.ping();\nif (!up) skipToolCall();","typeGuard":null,"tryCatchPattern":"try { content = mcpRuntimeToolService.callTool(tool, args); } catch (IOException e) { log.warn(\"MCP tool call failed, tool={}, errorType={}\", tool.toolName(), e.getClass().getSimpleName(), e); content = \"MCP tool call failed.\"; }","preventionTips":["Add readiness/liveness probes for the MCP runtime in Kubernetes","Configure sensible connect/read timeouts on the runtime client","Retry transient IOExceptions with backoff before surfacing failure to the model","Monitor MCP call failure rate per tool"],"tags":["mcp","io","network","tool-call"],"backgroundTag":"http-request-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}