Skip to main content
Canvas exposes two MCP tools in the Planning toolset. Both are visible to any agent connected to your Deal Brain MCP server with a valid session. A third internal tool (get_template) is used by Deal Brain’s own agent runtimes to hydrate a template before rendering. It is not exposed publicly over MCP.

list_templates

Returns all templates the calling user can see, deduplicated by scope precedence (User > Organization > System).

Input

No parameters. The tool always operates against the calling user’s identity.

Output

Returns two content blocks: a structuredContent JSON payload and a human-readable text summary.

Behavior

  • Returns only active templates. Drafts are invisible.
  • Returns only templates the calling user can see, with scope precedence applied — the user sees the most-specific version of each key.
  • Sort order: System templates first (alphabetical by key), then Organization, then User.

Example agent prompt

Show me all the available templates and pick the one closest to a “deal qualification readout.”
The agent calls list_templates, scans the descriptions, and chooses the best match by key.

generate_template

Renders a template by key, binding optional context (most commonly an opportunity ID), and returns the system prompt + rendered body ready for the LLM.

Input

string
required
The template’s stable key. Examples: daily-brief, user-templates/opportunity-readout-3p.
string
The UUID of the opportunity to bind. If the template uses opportunity variables and this is omitted, those variables render as empty.
object
Optional key-value pairs that override specific variables at render time. Useful for testing or for binding values not in the data layer.Example: { "company tone of voice": "casual and warm" }

Output

Returns two text blocks:
  1. System prompt — Deal Brain’s standard model directive plus any instruction variables compiled from the template.
  2. Rendered body — The template’s content with all data variables substituted.

Behavior

  • Scope precedence applies. The key resolves to User > Organization > System for the calling user.
  • Status gate. If the resolved template is draft, the tool returns an error.
  • Missing opportunity. If opportunityId refers to a deal the calling user can’t see, the tool returns an authorization error — not an empty render.
  • Missing variables. If a data variable’s value isn’t present in the bound context, it renders as an empty string. The template should be written to handle this gracefully.

Task-handoff semantics

For date-anchored templates (daily/meeting briefs and debriefs), generate_template supports MCP task handoff:
  • The first call kicks off the render asynchronously and returns a task ID.
  • Subsequent polling resolves to the final two-block output.
  • The result is cached per (template key, opportunity ID or date, calling user) for the cache window.
This avoids long-running blocking calls in agent conversations. Your MCP client handles polling automatically.
Draft-message templates (e.g., drafts/follow-up) do not support task handoff — they’re synchronous and not cached, because each draft is bespoke.

Errors

Example agent flow

Integration patterns

Customer-authored templates in a custom agent

If you’re building an agent on top of Deal Brain and want customers to author their own templates inside Deal Brain’s Canvas UI, the pattern is:
  1. Customer authors the template in Canvas, sets it to Active, and uses a key prefix you control (e.g., your-product/<feature>).
  2. Your agent calls list_templates, filters to keys starting with your-product/, and presents them to the customer as choices.
  3. Your agent calls generate_template({ key, opportunityId }) and sends the result to your LLM.
This lets your customers customize behavior without you shipping code.

Caching for repeated reads

For date-anchored templates that the agent calls repeatedly within the same window (e.g., a daily-brief checked multiple times in a morning), rely on the built-in task-handoff cache documented above — Deal Brain caches by (template key, opportunity ID or date, calling user) for the cache window, so repeated calls within the window hit the same render.

See also

  • Publishing — status, scope, and how a template becomes visible to list_templates.
  • Variables — the data and instruction tokens that templates resolve at render time.