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

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.

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

Source