Skip to main content
Glama

messages_preview

Essential pre-flight. Body: {segment_sqid, steps: [...], num_leads}. Picks num_leads random leads from the segment, renders each sequence step against them (variable substitution + spintax + AI snippet generation where {{prompts}} appear), and returns the final subject/body text each recipient would see.

Use this before campaigns_activate to catch template bugs: unresolved ${vars}, empty AI snippets, weird spintax. The response includes per-lead errors arrays listing any template issues — fix those in the sequence, then re-preview. Each lead also carries compliance: {allowed, reason_codes} — what the compliance gates would decide for it (a preview never blocks).

Cost. Renders are free; AI snippets cost COMPOSE_EMAIL connects per successful generation (pay-per-success — failed generations don't charge). num_leads × number of {{prompt}} snippets is the upper bound. Balance pre-check returns 402 if insufficient.

Method: POST /api/v1/workspaces/{workspace_sqid}/messages/preview/

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "segment_sqid": "<segment_sqid>",
      "steps": "<steps>"
    },
    "name": "messages_preview"
  }
}

Input Schema

NameRequiredDescriptionDefault
stepsYes
num_leadsNo
is_threadedNoPreview the steps as a threaded conversation, matching a sequence with `is_threaded` enabled: every step after the first gets a 'Re:' subject and quotes the preceding step.
segment_sqidYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations supplied, the description carries the full burden and does so well: renders are free, AI snippets cost COMPOSE_EMAIL connects per successful generation (failed generations aren't charged), `num_leads` × prompt count is the upper bound, and a balance pre-check returns 402. It also makes the non-blocking nature explicit with "a preview never blocks" and describes the response's per-lead `errors` and `compliance` payloads.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Bold section headers (usage, Cost) plus a front-loaded "Essential pre-flight" make it skimmable, and every paragraph contributes opeational detail. The inline `Body: {segment_sqid, steps: [...], num_leads}` line partly duplicates the input schema, and the trailing raw method/URL line is low-value for an agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema and no annotations, yet the description explains what comes back (rendered subject/body per lead, `errors` arrays, `compliance: {allowed, reason_codes}`) and the cost/402 failure mode. Auth requirements and rate limits are not mentioned, which is the main remaining hole for a 4-parameter tool with this much behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is only 25%, but the description compensates for the important gaps: `num_leads` means *random* leads sampled from the segment and drives cost as an upper bound, and `steps` behavior (variable substitution, spintax, `{{prompts}}` AI generation) is explained beyond the schema's field-level notes. `segment_sqid` is only implied as the source of leads, and no format hints are given, keeping it short of a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: it picks `num_leads` random leads from a segment, renders each sequence step against them (variable substitution, spintax, AI snippet generation), and returns the final subject/body per recipient. It also distinguishes itself from `campaigns_activate` by positioning itself as the pre-flight check, so an agent can tell them apart without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit timing guidance: "Use this before `campaigns_activate`" and the follow-up loop (fix errors in the sequence, then re-preview) is spelled out. It stops short of naming when *not* to use it or how it relates to other nearby options such as `messages_send_test` or `campaigns_generate_messages`, so guidance is strong but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.