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