yera.tools.mcp.results

Conversion of MCP results into Yera-supported Python values.

Symbols

def convert_tool_result — Convert an MCP tool result into its declared Python type.

convert_tool_result

convert_tool_result(
    result: CallToolResult,
    result_type: type,
) → object

Convert an MCP tool result into its declared Python type.

Parameters

result
type: CallToolResult

The raw result returned by the MCP server.

result_type
type: type

The generated Yera-supported result type.

Returns

type: object

The validated and coerced Python value.

Raises

MCPToolCallError

If the MCP server reports that the tool call failed.

TypeError

If the successful result does not contain structured content.

ValueError

If the result cannot be coerced to its declared type.