Interface McpToolResultExtractor

All Known Implementing Classes:
DefaultMcpToolResultExtractor

public interface McpToolResultExtractor
Extracts a ToolExecutionResult from a tool response content[] array.

This extension point is only used for ordinary MCP tool responses that return CallToolResult.result.content[]. It is not invoked when the MCP server returns structuredContent, which is handled separately.

This interface is not a general-purpose MCP content parsing framework. The default client only supports structuredContent and text content out of the box. More specialized extraction strategies can be provided through DefaultMcpClient.Builder.toolResultExtractor(McpToolResultExtractor).

  • Method Summary

    Modifier and Type
    Method
    Description
    extract(com.fasterxml.jackson.databind.JsonNode content, boolean isError)
    Extracts a ToolExecutionResult from CallToolResult.result.content[].
  • Method Details

    • extract

      ToolExecutionResult extract(com.fasterxml.jackson.databind.JsonNode content, boolean isError)
      Extracts a ToolExecutionResult from CallToolResult.result.content[].
      Parameters:
      content - the MCP tool result content array.
      isError - whether the tool response is marked as an application-level error.
      Returns:
      the extracted ToolExecutionResult.