Interface ToolContextToMcpMetaConverter


public interface ToolContextToMcpMetaConverter
Strategy interface for converting a ToolContext to a map of metadata to be sent as part of an MCP tool call.
Author:
Christian Tzolov, YunKui Lu
  • Method Details

    • convert

      Map<String,Object> convert(org.springframework.ai.chat.model.ToolContext toolContext)
      Convert the given ToolContext to a Mapinvalid input: '<'String, Object> as MCP tool call metadata.

      The default implementation ignores the McpToolUtils.TOOL_CONTEXT_MCP_EXCHANGE_KEY entry and any entries with null values.

      Parameters:
      toolContext - the tool context to convert
      Returns:
      a map of metadata to be sent as part of the MCP tool call
    • defaultConverter

      static ToolContextToMcpMetaConverter defaultConverter()
    • noOp

      Static factory method to create a no-op converter that returns an empty map.
      Returns:
      a no-op converter