DF0081: Invalid MCP Content Blocks

Tool "{name}" returned invalid MCP content blocks: {reason}

Message

Tool "{name}" returned invalid MCP content blocks: {reason}

Cause

A tool result carries content blocks from withMcpContent, but the blocks are not a non-empty array of valid blocks. A valid block is { type: 'text', text }, { type: 'image', data, mimeType } or { type: 'audio', data, mimeType }, and each field is a string. The MCP adapter does not send invalid blocks. It returns this error as an isError result of the tools/call request.

Example

import { withMcpContent } from 'devframe'

ctx.agent.registerTool({
  id: 'my-plugin:snapshot',
  description: 'Take a snapshot.',
  // The image block has no `mimeType`.
  handler: () => withMcpContent({}, [{ type: 'image', data: png }]),
})

Fix

Give withMcpContent at least one block, and give each block all of its fields: text for a text block, base64 data and a mimeType (for example image/png) for an image or audio block.

Source