CharDesk Docs

WebMCP

Tool ownership and composition for the live Canvas page.

HEAD a63778e

WebMCP tools have two owners. These are capability groups, not protocol versions or separate servers.

WebMCP
├─ Canvas      two-dimensional Cell space
└─ Materials   shared authoring reference
GroupToolsContract
Canvascanvas_manage, canvas_read, canvas_search, canvas_write, canvas_erase, canvas_fill, canvas_render, canvas_codeManage and operate on Scenes in original Cell coordinates. Freeform Scenes are infinite surfaces; Slide Scenes contain named, finite pages addressed by pageId. write is a literal Projection stroke; erase clears a region; fill styles existing characters; render converts material input such as Markdown or ANSI into Projection Cells. canvas_code composes these capabilities in a bounded QuickJS runtime with ordinary-object APIs; it reports runtime_unavailable with primitive-tool fallbacks if WASM cannot load. preview is the default and does not mutate; apply commits one undoable operation with an operationId. list_pages and page mutation actions are exposed through canvas_manage; content tools accept pageId without changing the user's active page. list returns active Canvases and short persistent canvasId values by default; pass includeArchived: true for archived Canvases. canvasId is optional and defaults to the active Canvas.
Materialschardesk_read_materialsRead-only Markdown shared by both workflows.

New spatial operations belong to Canvas; source-file editing remains outside these tools. Groups reuse existing runtimes and never own separate copies of application state.

Local MCP bridge

The local bridge keeps one browser page connection and multiplexes independent Agent tenants through it:

browser page ── one WebSocket ── bridge broker
                                  ├─ tenant A
                                  ├─ tenant B
                                  └─ tenant C

Each tenant has its own session token and pending-request budget. Requests are forwarded in FIFO order; a tenant disconnect does not close the page or affect other tenants. A second @chardesk/mcp server process joins the existing broker automatically instead of claiming a second browser connection.

Canvas reads keep machine metadata separate from visual content. canvas_read returns structuredContent for coordinates, sampling, and optional appearance regions, plus contentBlocks for text, image, or note blocks. The default is lightweight text without style notes; style: "appearance", representation: "cells", and image blocks are explicit so extra visual context is never silently added.

Page composition

The composition entry point builds the groups and flattens them for the host connector. Normal Canvas pages register all 8 Canvas tools. Local CLI reader pages register Canvas management, reading, searching, and Materials only. Workspace management pages register none. Grouping does not add a browser-visible category field or change registration order.

Authorities