Class DefaultMcpToolResultConverter
java.lang.Object
dev.langchain4j.mcp.client.DefaultMcpToolResultConverter
- All Implemented Interfaces:
McpToolResultConverter
Default converter for MCP tool responses backed by
content[].
Supports text, images and embedded text resources. Images are returned as native
ImageContent, preserving mixed-content order. Text-only results are joined
with newlines so ToolExecutionResult.resultText() remains available.
Binary resources and other unsupported content types fail explicitly; applications
can provide a custom converter for them.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultMcpToolResultConverter
public DefaultMcpToolResultConverter()
-
-
Method Details
-
convert
- Specified by:
convertin interfaceMcpToolResultConverter- 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 contents are what the model sees.
-