Skip to content

fix: handle structuredContent in MCP tool responses#1149

Closed
kundeng wants to merge 1 commit intoagent0ai:mainfrom
kundeng:fix/1147-structured-content
Closed

fix: handle structuredContent in MCP tool responses#1149
kundeng wants to merge 1 commit intoagent0ai:mainfrom
kundeng:fix/1147-structured-content

Conversation

@kundeng
Copy link
Copy Markdown

@kundeng kundeng commented Feb 27, 2026

Summary

MCPTool.execute() now includes structuredContent JSON in the tool response message when present.

Some MCP servers (e.g. Splunk MCP) return their actual payload data exclusively in structuredContent, while the content text blocks contain only a brief summary like "Tool executed successfully (100 results)." The result is that Agent Zero sees only the summary and never receives the actual data.

Changes

In MCPTool.execute(), after joining text content blocks, check if response.structuredContent is present and non-None. If so, serialize it to JSON and append it to the message.

if getattr(response, "structuredContent", None):
    structured_str = json.dumps(response.structuredContent, indent=2)
    if message:
        message = message + "\n\n" + structured_str
    else:
        message = structured_str

C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C##ny]## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## C## Cler.py`

Fixes #1147

MCPTool.execute() now includes structuredContent JSON in the tool
response message when present. Some MCP servers (e.g. Splunk MCP)
return their actual payload data exclusively in structuredContent,
while the content text blocks contain only a brief summary.

Fixes #1147
WingedGuardian added a commit to WingedGuardian/agent-zero that referenced this pull request Mar 1, 2026
…tent

Cherry-picked from community PRs:
- agent0ai#1149 (kundeng): Handle structuredContent in MCP tool responses
- agent0ai#1150 (kundeng): Resolve §§secret()/$$secret() in MCP server env/headers/url

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kundeng kundeng closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Handle structuredContent in MCP tool responses

1 participant