类 McpContentConverter
java.lang.Object
io.agentscope.core.tool.mcp.McpContentConverter
Utility class for converting between MCP content types and AgentScope content blocks.
This converter handles the translation of MCP protocol data structures to AgentScope's
internal representation.
Supported conversions:
- MCP CallToolResult → AgentScope ToolResultBlock
- MCP TextContent → AgentScope TextBlock
- MCP ImageContent → AgentScope ImageBlock
- MCP AudioContent → AgentScope AudioBlock (future)
-
方法概要
修饰符和类型方法说明static ToolResultBlockconvertCallToolResult(io.modelcontextprotocol.spec.McpSchema.CallToolResult mcpResult) Converts an MCP CallToolResult to an AgentScope ToolResultBlock.static ContentBlockconvertContent(io.modelcontextprotocol.spec.McpSchema.Content content) Converts a single MCP Content to an AgentScope ContentBlock.static List<ContentBlock> convertContentList(List<io.modelcontextprotocol.spec.McpSchema.Content> mcpContents) Converts a list of MCP Content to AgentScope ContentBlocks.
-
方法详细资料
-
convertCallToolResult
public static ToolResultBlock convertCallToolResult(io.modelcontextprotocol.spec.McpSchema.CallToolResult mcpResult) Converts an MCP CallToolResult to an AgentScope ToolResultBlock.- 参数:
mcpResult- the MCP tool call result- 返回:
- the converted ToolResultBlock
-
convertContentList
public static List<ContentBlock> convertContentList(List<io.modelcontextprotocol.spec.McpSchema.Content> mcpContents) Converts a list of MCP Content to AgentScope ContentBlocks.- 参数:
mcpContents- the list of MCP content- 返回:
- list of converted ContentBlocks
-
convertContent
Converts a single MCP Content to an AgentScope ContentBlock.- 参数:
content- the MCP content- 返回:
- the converted ContentBlock, or null if conversion is not supported
-