McpToolResponse class

Full MCP tool response with explicit content blocks and optional structured content. Return an instance of this class from a tool handler when you need full control over both the content array and structuredContent.

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

Constructor Details

McpToolResponse(McpToolResponseInit)

new McpToolResponse(init: McpToolResponseInit)

Parameters

Property Details

content

content: McpContentBlock[]

Property Value

isError

isError?: boolean

Property Value

boolean

structuredContent

structuredContent?: unknown

Property Value

unknown