Interface McpToolResultConverter
- All Known Implementing Classes:
DefaultMcpToolResultConverter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Converts the content blocks of an MCP
CallToolResult into the
ToolExecutionResult the model sees. It is not invoked when the MCP server
returns structuredContent, which is handled separately.
Content items are presented as plain maps, so implementations do not need a JSON library.
A text item, for example, looks like {"type": "text", "text": "..."}.
The default client only supports structuredContent and text content out of the box.
More specialized conversion strategies can be provided through
DefaultMcpClient.Builder.toolResultConverter(McpToolResultConverter).
-
Method Summary
-
Method Details
-
convert
- Parameters:
content- the content blocks ofCallToolResult.isError- whether the tool response is marked as an application-level error.- Returns:
- the result to hand back to the caller, whose text is what the model sees.
-