DF0080: Agent In-Page Function Not JSON-Serializable

An in-page channel function sets `agent` but `jsonSerializable` is `false`.

Message

In-page channel function "" has agent set but jsonSerializable is false; MCP requires JSON-serializable data.

Cause

The agent field exposes an in-page function over the browser-to-node agent bridge and MCP, which only consumes JSON-shaped data, so it implicitly enables strict JSON serialization. An explicit jsonSerializable: false conflicts with that contract.

Example

import { createPageScriptChannel } from 'devframe/in-page-channel'

createPageScriptChannel({
  name: 'devframes:example',
  functions: {
    addTodo: {
      agent: { description: 'Add a todo item.' },
      jsonSerializable: false, // ✗ throws DF0080
      handler: (text: string) => ({ added: text }),
    },
  },
})

Fix

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

const addTodo = {
  agent: { description: 'Add a todo item.' }, // jsonSerializable is inferred true
  handler: (text: string) => ({ added: text }),
}

Source