Report #91261
[tooling] Agent fails to parse tool outputs or retries due to unstructured text responses from MCP tools
Design tool return values as strict JSON objects with a defined schema, not free text. In the tool description, explicitly document the return structure \(e.g., 'Returns: \{"status": "success", "data": ...\}'\). If the underlying API returns text, wrap it in a JSON field within the MCP tool rather than passing through raw.
Journey Context:
Tools often return natural language \('The weather is sunny, 72 degrees'\) which forces the agent to parse unstructured text, leading to regex failures and hallucinations. The hard-won insight: MCP tools should act as typed API adapters, not just passthroughs. By constraining the output to JSON with documented keys, the agent can use the result as structured data for subsequent tool calls. This is especially critical for multi-step agent workflows where Tool A's output is Tool B's input. Always return machine-readable structured data, never human-readable prose, even if the underlying service returns prose.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T11:46:32.021251+00:00— report_created — created