Skip to main content
Canvas exposes a public MCP tool surface that any AI agent can call — Claude, ChatGPT, Cursor, or anything else that speaks the Model Context Protocol. Templates authored in the Deal Brain web editor are immediately discoverable and renderable through these tools. This page covers the concepts you need before reading the MCP tool reference: how the surface fits together, how auth works, how keys resolve, what a render actually does, and how to find your renders in tracing.

Architecture at a glance

A template authored in the web UI is rendered the same way for every agent: scope-resolved, variables bound, status-gated, and traced in Langfuse with the template’s key, status, and scope for audit.

Authentication

Templates resolve per-user, so the calling identity determines what’s visible. A User-scoped template authored by Alice is not visible to a Bob-authenticated MCP session, even within the same organization.

Template keys

Every template has a stable key — the string your agent uses to refer to it. Three conventions: Keys are case-sensitive. Treat them as opaque identifiers in your code — Deal Brain may add new system keys over time, but existing ones won’t change.

The render contract

A call to generate_template does six things:
  1. Resolves the template by key, applying User > Org > System precedence for the calling user.
  2. Verifies status is Active. Draft templates return an error.
  3. Binds context — opportunity ID, identity (user/org), and any additional variables you pass.
  4. Substitutes data variables with their resolved values; preserves missing values as empty strings.
  5. Emits the rendered body — markdown with data variables filled in and instruction variables flagged as model directives.
  6. Returns the system prompt + rendered body in two text blocks, with cache hints for the model.
Steps 1–5 are deterministic — the same template + the same context + the same calling user always produces the same render. Step 6 hands off to an LLM, where determinism ends.

Tracing

Every Canvas render emits a Langfuse trace with these metadata fields: Use these for usage analytics, debugging, and audit.

Next steps

MCP tool contract

The full generate_template and list_templates reference — input schemas, output shapes, error modes, and integration patterns.