iflytek/astron-agent · warning

MCP tool call failed, tool=

Error message

MCP tool call failed, tool={}, errorType={}

What it means

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.

Solutions

  1. Check MCP runtime service health and restart it if down
  2. Verify the MCP runtime endpoint URL/port configured in hub matches the deployed service
  3. Test network connectivity from the hub pod to the MCP runtime (DNS, network policies)
  4. Retry the chat/tool call — the failure may be transient; investigate repeated occurrences

Example fix

null
Defensive patterns

Strategy: fallback

Validate before calling

// health-check the MCP runtime before tool dispatch
boolean up = mcpRuntimeHealthIndicator.ping();
if (!up) skipToolCall();

Try / catch

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."; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/238d223b5c0078f4. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/springai/McpToolCallbackFactory.java:74

        @Override
        public String call(String toolInput) {
            log.info("mcp tool invoked, tool={}", tool.toolName());
            JSONObject args;
            try {
                args = StringUtils.isBlank(toolInput) ? new JSONObject() : JSON.parseObject(toolInput);
            } catch (Exception e) {
                log.warn(
                        "Failed to parse MCP tool input as JSON, tool={}, inputBytes={}, errorType={}",
                        tool.toolName(),
                        toolInput == null ? 0 : toolInput.getBytes(StandardCharsets.UTF_8).length,
                        e.getClass().getSimpleName());
                args = new JSONObject();
            }
            String content;
            try {
                content = mcpRuntimeToolService.callTool(tool, args);
            } catch (IOException e) {
                log.warn(
                        "MCP tool call failed, tool={}, errorType={}",
                        tool.toolName(),
                        e.getClass().getSimpleName());
                content = "MCP tool call failed.";
            }
            context.addTrace(new JSONObject()
                    .fluentPut("type", "mcp")
                    .fluentPut("deskToolName", "MCP: " + tool.toolName())
                    .fluentPut("toolName", tool.toolName())
                    .fluentPut("arguments", args)
                    .fluentPut("content", StringUtils.abbreviate(content, 2000)));
            return content;
        }
    }
}

View on GitHub (pinned to 5e758547a8)