Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/strands/tools/mcp/mcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ def _handle_tool_result(self, tool_use_id: str, call_tool_result: MCPCallToolRes
status=status,
toolUseId=tool_use_id,
content=mapped_contents,
_meta=call_tool_result.meta,
Copy link
Member

Choose a reason for hiding this comment

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

hi a couple small things,

  1. lets be consistent with structuredContent and only provide it if call_tool_result.meta, is not none.
  2. I think I prefer to just have meta instead of _meta
  3. lets add unit tests
  4. Lets add integ tests by modifying our echo_server in the tests_integ/mcp/

)

if call_tool_result.structuredContent:
Expand Down
5 changes: 4 additions & 1 deletion src/strands/tools/mcp/mcp_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ class MCPToolResult(ToolResult):
that provides structured results beyond the standard text/image/document content.

Attributes:
_meta:
See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
for notes on _meta usage.
structuredContent: Optional JSON object containing structured data returned
by the MCP tool. This allows MCP tools to return complex data structures
that can be processed programmatically by agents or other tools.
"""

_meta: NotRequired[Dict[str, Any]]
structuredContent: NotRequired[Dict[str, Any]]