DF0019: Agent Requires JSON-Serializable RPC

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

Message

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

Cause

The agent field exposes an RPC function as an MCP tool, and MCP only consumes JSON-shaped data. A function with agent set is rejected unless it also declares jsonSerializable: true.

Example

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

Fix

Set jsonSerializable: true if the payload is JSON-safe, or remove agent to keep it RPC-only.

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

Source