From 9458df624f34c291a0fe7e17578c12f6f376937c Mon Sep 17 00:00:00 2001 From: Amashiro Date: Sun, 28 Sep 2025 17:03:38 +0800 Subject: [PATCH] feat(mcp): Add a new field _meta to MCPToolResult --- src/strands/tools/mcp/mcp_client.py | 1 + src/strands/tools/mcp/mcp_types.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/strands/tools/mcp/mcp_client.py b/src/strands/tools/mcp/mcp_client.py index dec8ec313..5f6f3c5b6 100644 --- a/src/strands/tools/mcp/mcp_client.py +++ b/src/strands/tools/mcp/mcp_client.py @@ -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, ) if call_tool_result.structuredContent: diff --git a/src/strands/tools/mcp/mcp_types.py b/src/strands/tools/mcp/mcp_types.py index 66eda08ae..7caeb2041 100644 --- a/src/strands/tools/mcp/mcp_types.py +++ b/src/strands/tools/mcp/mcp_types.py @@ -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]]