strands.tools.mcp.mcp_types
¶
Type definitions for MCP integration.
MCPTransport = AbstractAsyncContextManager[MessageStream | _MessageStreamWithGetSessionIdCallback]
module-attribute
¶
_MessageStreamWithGetSessionIdCallback = tuple[MemoryObjectReceiveStream[SessionMessage | Exception], MemoryObjectSendStream[SessionMessage], GetSessionIdCallback]
module-attribute
¶
MCPToolResult
¶
Bases: ToolResult
Result of an MCP tool execution.
Extends the base ToolResult with MCP-specific structured content support. The structuredContent field contains optional JSON data returned by MCP tools that provides structured results beyond the standard text/image/document content.
Attributes:
| Name | Type | Description |
|---|---|---|
structuredContent |
NotRequired[dict[str, Any]]
|
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. |
metadata |
NotRequired[dict[str, Any]]
|
Optional arbitrary metadata returned by the MCP tool. This field allows MCP servers to attach custom metadata to tool results (e.g., token usage, performance metrics, or business-specific tracking information). |
Source code in strands/tools/mcp/mcp_types.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
ToolResult
¶
Bases: TypedDict
Result of a tool execution.
Attributes:
| Name | Type | Description |
|---|---|---|
content |
list[ToolResultContent]
|
List of result content returned by the tool. |
status |
ToolResultStatus
|
The status of the tool execution ("success" or "error"). |
toolUseId |
str
|
The unique identifier of the tool use request that produced this result. |
Source code in strands/types/tools.py
88 89 90 91 92 93 94 95 96 97 98 99 | |