Package org.springframework.ai.mcp
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 Summary
Modifier and TypeMethodDescriptionconvert
(ToolContext toolContext) Convert the givenToolContext
to a Map<String, Object> as MCP tool call metadata.noOp()
Static factory method to create a no-op converter that returns an empty map.
-
Method Details
-
convert
Convert the givenToolContext
to a Map<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
-
noOp
Static factory method to create a no-op converter that returns an empty map.- Returns:
- a no-op converter
-