Class DefaultMcpToolResultExtractor
java.lang.Object
dev.langchain4j.mcp.client.DefaultMcpToolResultExtractor
- All Implemented Interfaces:
McpToolResultExtractor
Default extractor for MCP tool responses backed by
content[].
This implementation preserves the existing client behavior: it only supports
content items of type text, joins multiple text fragments with
newline characters, and stores the result in ToolExecutionResult.resultText().
It does not apply to responses that contain structuredContent.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextract(com.fasterxml.jackson.databind.JsonNode content, boolean isError) Extracts aToolExecutionResultfromCallToolResult.result.content[].
-
Constructor Details
-
DefaultMcpToolResultExtractor
public DefaultMcpToolResultExtractor()
-
-
Method Details
-
extract
public ToolExecutionResult extract(com.fasterxml.jackson.databind.JsonNode content, boolean isError) Description copied from interface:McpToolResultExtractorExtracts aToolExecutionResultfromCallToolResult.result.content[].- Specified by:
extractin interfaceMcpToolResultExtractor- Parameters:
content- the MCP tool result content array.isError- whether the tool response is marked as an application-level error.- Returns:
- the extracted
ToolExecutionResult.
-