Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agents/mcp/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ async def invoke_mcp_tool(

# If structured content is requested and available, use it exclusively
tool_output: ToolOutput
if server.use_structured_content and result.structuredContent:
if server.use_structured_content and result.structuredContent is not None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update tests for empty structured content

When this branch now serializes empty structured content such as {} instead of falling back to result.content, the committed tests still assert the old fallback behavior (for example tests/mcp/test_mcp_util.py::test_structured_content_handling scenario 4 and test_empty_structured_content_fallback). That leaves the MCP test suite failing for the exact case this change intends to fix, so the expected outputs/regression tests need to be updated in the same change.

Useful? React with 👍 / 👎.

tool_output = json.dumps(result.structuredContent)
else:
tool_output_list: list[ToolOutputItem] = []
Expand Down
Loading