你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。

McpToolResponse class

完整的 MCP 工具响应,包含明确的内容块和可选的结构化内容。 当你需要对内容数组和 structuredContent都进行完全控制时,从工具处理器返回该类的实例。

return new McpToolResponse({
  content: [
    new McpTextContent('Here is the image'),
    new McpImageContent({ data: base64Data, mimeType: 'image/png' })
  ],
  structuredContent: { imageId: 'logo', format: 'png' }
});

构造函数详细信息

McpToolResponse(McpToolResponseInit)

new McpToolResponse(init: McpToolResponseInit)

参数

属性详细信息

content

content: McpContentBlock[]

属性值

isError

isError?: boolean

属性值

boolean

structuredContent

structuredContent?: unknown

属性值

unknown