---
title: "DF0019: Agent Requires JSON-Serializable RPC"
description: "RPC function \"{name}\" has agent set but jsonSerializable is false; MCP requires JSON-serializable data."
canonical_url: "https://devfra.me/errors/df0019"
---
# DF0019: Agent Requires JSON-Serializable RPC

> RPC function "\{name}" has agent set but jsonSerializable is false; MCP requires JSON-serializable data.

## Message

> RPC function "`{name}`" has `agent` set but `jsonSerializable` is `false`; MCP requires JSON-serializable data.

## Cause

The `agent` field exposes an RPC function as an MCP tool and implicitly enables strict JSON serialization. An explicit `jsonSerializable: false` conflicts with MCP's JSON-shaped data.

## Example

```ts
defineRpcFunction({
  name: 'my-plugin:summary',
  agent: { description: 'Returns a summary' },
  jsonSerializable: false, // ✗ throws DF0019
  handler: () => ({
    items: [1, 2, 3]
  }),
})
```

## Fix

Remove `jsonSerializable: false` to use the implicit JSON contract, or remove `agent` to keep the function RPC-only.

```ts
defineRpcFunction({
  name: 'my-plugin:summary',
  jsonSerializable: true,
  agent: { description: 'Returns a summary' },
  handler: () => ({
    items: [1, 2, 3]
  }),
})
```

## Source

- [`packages/devframe/src/rpc/agent-json-serialization.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/rpc/agent-json-serialization.ts): `ensureAgentJsonSerializable()` throws `DF0019` when a definition combines `agent` with `jsonSerializable: false` during registration or static dump collection.


## Sitemap

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