Skip to main content
Glama

Preview mail merge

preview_mail_merge
Read-onlyIdempotent

Use this when the user wants to check a mail merge before printing: see how their spreadsheet (CSV or Excel) or list fills a letter, certificate or envelope template, which template fields like {{First Name}} have no matching column, which columns were matched by a similar name (first_name for First Name), and which records have empty values. Returns the first 3 merged records (or from preview_from) and a missing-field report; no files. Does not send email, print, or make labels. Do not use for Outlook or Gmail email merges.

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": {
      "document_type": "<document_type>"
    },
    "name": "preview_mail_merge"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateNoDate printed on letters and certificates and used for {{today}}, as YYYY-MM-DD, e.g. 2026-10-03. Defaults to today (US Eastern time); pass the user's local date when known.
fileNoThe spreadsheet with one row per recipient: Excel .xlsx, CSV or TSV, first row = column headers, e.g. donors.xlsx.
namesNoShortcut for a plain list of names (one column called Name), e.g. ["Ana Lopez", "Ben Okafor"]. Handy for certificates.
sheetNoFor an .xlsx file: the sheet (tab) name to use, e.g. Donors. Defaults to the first sheet that has data.
styleNoCertificates: design style: classic (navy double border), gold (cream with gold seal), modern (teal geometric), deco (burgundy art deco). Default classic.
senderNoLetters: your name/organization and address at the top. Envelopes: the return address. One line per entry, e.g. ["Riverbend Animal Shelter", "120 Elm St", "Springfield, IL 62701"].
closingNoLetters: closing line, e.g. "With gratitude,". Defaults to "Sincerely," unless the template already ends with a closing. Use "" for none.
recordsNoAlternative to a file: the recipients typed as objects with the same keys, e.g. [{"First Name": "Ana", "Last Name": "Lopez", "Amount": 250}].
signersNoCertificates: up to 3 signature lines, e.g. [{"name": "Alan Brooks", "title": "Principal"}].
subjectNoLetters: optional subject line printed as "Re: ...", may contain fields, e.g. "Your {{Year}} giving statement".
csv_textNoAlternative to a file: the list pasted as CSV or tab-separated text with a header row, e.g. "First Name,Last Name,City\nAna,Lopez,Austin".
templateNoLetters: the letter text from the salutation to the last paragraph, with merge fields, e.g. "Dear {{First Name|Friend}},\n\nThank you for your gift of {{Amount:currency}} on {{Gift Date:date}}.{{#if Company}} Please thank everyone at {{Company}}.{{/if}}". Syntax: {{Field}}, {{Field|default}}, {{Field:format}} with formats currency, number, integer, ordinal, date, short_date, iso_date, upper, lower, title, first_word, last_word; {{#if Field}}...{{else}}...{{/if}}, {{#if Field = value}}, {{#if Gift > 0}} (also !=, <, >=, <=; numbers or dates), {{#unless Field}}...{{/unless}}; {{today}} is the document date.
field_mapNoOptional explicit links from template fields to column names when names differ, e.g. {"Gift": "Donation Amount (USD)"}.
has_headerNoSet false if the first row of the file is data, not column names (columns are then called Column A, Column B, ...). Default true.
usps_styleNoEnvelopes: print the delivery address in USPS style (uppercase, no periods or commas). Default false.
organizationNoCertificates: issuing organization printed at the top, e.g. Lincoln Elementary School.
preview_fromNoRecord number to start the preview at, e.g. 1 (default) or 25 to check later rows.
body_templateNoCertificates: the line under the name, may contain fields, e.g. "for completing {{Course}} ({{Hours}} hours) on {{Completed:date}}".
document_typeYesWhat to merge into: letter (US business letter, one per row), certificate (landscape award/completion/participation certificate, one per row), or envelope (#10 envelope with recipient and return address). Example: letter.
envelope_sizeNoEnvelopes: "10" for a #10 business envelope 4-1/8 x 9-1/2 in (default) or "a7" for a 5-1/4 x 7-1/4 in invitation envelope.
missing_valuesNoWhat to do when a record has an empty value for a field with no default: leave_blank (default), skip_record (leave that record out), or placeholder (print [Field Name] for proofreading).
presented_lineNoCertificates: the line above the name. Default "This certificate is proudly presented to" ("This certifies that" for completion).
signature_nameNoLetters: name printed under the closing, e.g. Maria Chen.
include_addressNoLetters: print the recipient address block above the salutation. Default true when the sheet has address columns.
signature_titleNoLetters: title under the signature name, e.g. Executive Director.
address_templateNoOptional recipient address block (letters: inside address; envelopes: delivery address), one line per row, e.g. "{{First Name}} {{Last Name}}\n{{Street}}\n{{City}}, {{State}} {{ZIP}}". Defaults to one built from the name, company and address columns.
certificate_kindNoCertificates: sets the default title and wording, e.g. completion -> "Certificate of Completion". Default achievement.
certificate_titleNoCertificates: custom title, e.g. "Certificate of Appreciation" or "Volunteer of the Year".
recipient_templateNoCertificates: the name line, e.g. "{{First Name}} {{Last Name}}". Defaults to the Name column (or First + Last).

Output Schema

NameRequiredDescriptionDefault
batchYes
paperYes
styleYes
countsYes
fieldsYes
sourceYes
missingYes
previewYes
summaryYes
warningsYes
downloadsYes
document_typeYes
missing_totalYes
unmatched_fieldsYes
needs_confirmationYes

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?

Beyond the readOnly/idempotent annotations, the description discloses concrete preview behavior: it returns the first 3 merged records or starts from preview_from, includes a missing-field report, and produces no files. It also rules out side effects like sending email, printing, or making labels.

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

Conciseness5/5

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

The description is front-loaded with the primary use case, then output behavior, then exclusions. Every sentence carries useful information, and there is no redundant restatement of the name or title.

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

Completeness5/5

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

Given the high parameter count and fully documented schema, the description supplies the key missing context: what the preview returns, that no files are produced, and which merge scenarios are out of scope. With an output schema present, it does not need to enumerate return fields further.

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

Parameters3/5

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

Schema description coverage is already 100%, so the schema fully documents the 29 parameters. The description only lightly reinforces a few concepts like preview_from and template field matching, without adding meaning beyond the schema; baseline 3 is appropriate.

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 uses a specific verb and resource ('preview mail merge') and immediately scopes it to checking a merge before printing. It clearly distinguishes this from file-generating or email-sending operations by saying 'no files' and excluding Outlook/Gmail merges.

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?

It gives clear when-to-use guidance ('check a mail merge before printing') and explicit when-not-to-use guidance ('Do not use for Outlook or Gmail email merges'). It does not explicitly name the sibling generate_merged_documents as the alternative for producing files, so the routing is implied rather than fully explicit.

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.

Resources