---
title: "DF0081: Invalid MCP Content Blocks"
description: "Tool \"{name}\" returned invalid MCP content blocks: {reason}"
canonical_url: "https://devfra.me/errors/df0081"
---
# 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

```ts
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

- [`packages/agentic/src/mcp/build-server.ts`](https://github.com/devframes/devframe/blob/main/packages/agentic/src/mcp/build-server.ts): `mcpContentOf()` throws this when the content blocks of a `tools/call` result are invalid.


## Sitemap

See the full [sitemap](https://devfra.me/sitemap.md) for all pages.
