iflytek/astron-agent · error · BusinessException

RESPONSE_FAILED

RESPONSE_FAILED

Error message

${message}

What it means

debugServerTool invokes an MCP server tool over HTTP; when the response JSON has code != 0 it propagates the downstream 'message' verbatim in a BusinessException(RESPONSE_FAILED). This means the MCP tool call reached the server but the server reported an error.

Solutions

  1. Read the propagated downstream message — it is the MCP server's own error text
  2. Validate tool arguments against the tool's declared input schema before calling
  3. Confirm the tool name still exists on the MCP server (re-fetch the tool list)
  4. Check the MCP server logs for the failing tool execution

Example fix

// before
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, respObject.getString("message"));
// after
String detail = respObject.getString("message");
log.error("Mcp tool call rejected: code={}, message={}", respObject.getIntValue("code"), detail);
throw new BusinessException(ResponseEnum.RESPONSE_FAILED, detail);
Defensive patterns

Strategy: try-catch

Validate before calling

// validate tool args against the tool's schema before debugServerTool
boolean valid = jsonSchemaValidator.validate(toolInputSchema, args);
if (!valid) throw new IllegalArgumentException("tool args do not match schema");

Try / catch

try {
    JSONObject result = mcpServerHandler.debugServerTool(req);
} catch (BusinessException e) {
    // message is the MCP server's own error text; show it to the debugger
    log.warn("tool call failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: HTTP POST to the MCP tool-call endpoint returns JSON with non-zero code (e.g. tool not found on the server, invalid tool arguments, tool execution failure).

Common situations: Debugging a tool whose arguments don't match the server schema; MCP server registered but the tool was removed/renamed; server-side execution error in the tool implementation.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/handler/McpServerHandler.java:174

        }
    }

    /**
     * Debug tool
     *
     * @param req
     */
    public JSONObject debugServerTool(JSONObject req) {
        try {
            String url = apiUrl.getToolUrl() + MCP_SERVER_CALL_TOOL;
            log.info("Mcp tool call url:{}\ndata:{}", url, JSON.toJSONString(req));
            String resp = OkHttpUtil.post(url, req.toString());
            JSONObject respObject = JSON.parseObject(resp);
            log.info("Mcp tool call response data:{}", resp);
            if (respObject.getIntValue("code") == 0) {
                return respObject.getJSONObject("data");
            }
            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, respObject.getString("message"));
        } catch (Exception e) {
            log.info("Mcp tool call error");
            throw new BusinessException(ResponseEnum.FAILED_TOOL_CALL);
        }
    }

    public JSONObject getMcpServerInfo(String serverId) {
        try {
            String url = apiUrl.getMcpToolServer() + MCP_SERVER_INFO + "?mcp_server_id=" + URLEncoder.encode(serverId, StandardCharsets.UTF_8.name());

            log.info("Mcp server info url:{}\ndata:{}", url, serverId);
            String resp = OkHttpUtil.get(url);
            JSONObject respObject = JSON.parseObject(resp);
            log.info("Mcp server info response data:{}", resp);
            if (respObject.getIntValue("code") == 0) {
                return respObject.getJSONObject("data");
            }
            throw new BusinessException(ResponseEnum.FAILED_MCP_GET_DETAIL);

View on GitHub (pinned to 5e758547a8)