Skip to content

fix: support structuredContent in MCP tool responses#494

Open
layer4down wants to merge 2 commits intojundot:mainfrom
layer4down:fix/mcp-websearch-empty-output
Open

fix: support structuredContent in MCP tool responses#494
layer4down wants to merge 2 commits intojundot:mainfrom
layer4down:fix/mcp-websearch-empty-output

Conversation

@layer4down
Copy link
Copy Markdown

Summary

Fixes issue #469 where MCP web search tools (e.g., victor/websearch HuggingFace Space) returned empty output despite successful tool execution.

Problem

MCP web search servers return results in the structuredContent field of CallToolResult, but the _extract_content method only checked the content field, resulting in empty responses.

Solution

Modified _extract_content in omlx/mcp/client.py to fall back to structuredContent when content is empty or not present.

Changes

  • omlx/mcp/client.py: Added structuredContent fallback in _extract_content method (lines 359-361)
  • tests/test_mcp_client.py: Added test case test_call_tool_structured_content to verify the fix

Testing

All 36 MCP client tests pass, including the new test:

tests/test_mcp_client.py: 36/36 passed (including test_call_tool_structured_content)

Related

Closes #469

Hunter Br added 2 commits March 31, 2026 04:21
- Add fallback to structuredContent when content is empty
- Web search MCP servers return results in structuredContent field
- Fixes issue jundot#469 where web search tools returned empty output
- Add test case for structuredContent support
@jundot jundot force-pushed the main branch 2 times, most recently from 2d46d30 to d0f5a38 Compare April 2, 2026 02:13
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.

[MCP] Web search returns no output

1 participant