Skip to main content
Glama

Create a mail order draft

postalform.create_order_draft

Prepare an existing PDF for mailing and return the order ID, total, hosted checkout URL, and checkout session. After buyer approval, a compatible client can pass a Stripe shared payment token to complete_checkout; otherwise present the hosted checkout URL. To prepare for MPP, set payment_protocol=mpp and buyer_email; receive a PDF preview, hosted checkout_url fallback and MPP challenge, then use postalform.pay_order with the order_id after buyer approval. Draft creation never pays. For x402, use postalform.create_machine_order.

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": {
      "pdf": "<pdf>",
      "sender_name": "<sender_name>",
      "sender_address_type": "<sender_address_type>",
      "recipient_name": "<recipient_name>",
      "recipient_address_type": "<recipient_address_type>"
    },
    "name": "postalform.create_order_draft"
  }
}

Input Schema

NameRequiredDescriptionDefault
pdfYesThe PDF to mail. Accepts attachment objects ({ download_url, file_id }). Fallbacks: upload_token from postalform.create_pdf_upload, data:application/pdf;base64,..., or a public HTTPS download URL.
colorNoWhether to print in color (default: false).
certifiedNoWhether to add proof mail: USPS Certified Mail for US destinations, Canada Post Registered Mail through PostGrid for Canadian destinations, or PinGen registered mail for supported European destinations (default: false).
file_nameNoOptional display file name.
buyer_nameNoReceipt name; defaults to sender_name for MPP.
mail_classNoMail service level (standard, priority, express).
request_idNoOptional idempotency key. Reuse the same value if retrying the call.
buyer_emailNoRequired for MPP receipt delivery.
sender_nameYesSender's name (return address).
double_sidedNoWhether to print double-sided (default: true).
recipient_nameYesRecipient's name.
sender_companyNoOptional company, department or attention line printed under sender_name in the return address (at most 40 characters).
payment_protocolNoOptional payment path. Defaults to hosted checkout. Choose mpp to return a payment challenge for this same prepared order; buyer_email is required. Draft creation never pays.
recipient_companyNoOptional company, department or attention line printed under recipient_name, for example "Acme Corp, ATTN: Legal" (at most 40 characters).
sender_address_idNoLoqate address id for the sender (required when sender_address_type is Address).
sender_address_textNoHuman-readable sender address preview (required when sender_address_type is Address; optional for Manual).
sender_address_typeYesAddress suggestion type for the sender (from postalform.search_addresses). Use Manual to pass a structured address with countryCode when outside the US.
recipient_address_idNoLoqate address id for the recipient (required when recipient_address_type is Address).
sender_address_manualNoSender manual address fields (required when sender_address_type is Manual).
recipient_address_textNoHuman-readable recipient address preview (required when recipient_address_type is Address; optional for Manual).
recipient_address_typeYesAddress suggestion type for the recipient (from postalform.search_addresses). Use Manual to pass a structured address with countryCode when outside the US.
certified_return_receiptNoAdd Electronic Return Receipt for US Certified Mail. Ignored for Canada Post Registered Mail and PinGen registered-mail destinations (default: false).
recipient_address_manualNoRecipient manual address fields (required when recipient_address_type is Manual).

Output Schema

NameRequiredDescriptionDefault
viewYes
is_paidNo
paymentNo
order_idYes
price_usdYes
page_countYes
preview_urlNo
sender_nameYes
checkout_urlYes
payment_statusNo
recipient_nameYes
sender_companyNo
checkout_sessionNo
payment_protocolNo
delivery_estimateNo
recipient_companyNo
sender_address_textYes
recipient_address_textYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • changedInput schema / properties / recipient_address_manual / required
      Previous value: -[
      -  "line1",
      -  "line2",
      -  "city",
      -  "zip"
      -]New value: +[
      +  "line1",
      +  "city",
      +  "zip"
      +]
    • addedInput schema / properties / recipient_company
      Added value: +{
      +  "description": "Optional company, department or attention line printed under recipient_name, for example \"Acme Corp, ATTN: Legal\" (at most 40 characters).",
      +  "maxLength": 40,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / sender_address_manual / required
      Previous value: -[
      -  "line1",
      -  "line2",
      -  "city",
      -  "zip"
      -]New value: +[
      +  "line1",
      +  "city",
      +  "zip"
      +]
    • addedInput schema / properties / sender_company
      Added value: +{
      +  "description": "Optional company, department or attention line printed under sender_name in the return address (at most 40 characters).",
      +  "maxLength": 40,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedOutput schema / properties / delivery_estimate
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "earliest": {
      +          "type": "string"
      +        },
      +        "label": {
      +          "type": "string"
      +        },
      +        "latest": {
      +          "type": "string"
      +        },
      +        "print_by": {
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "earliest",
      +        "latest",
      +        "label"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / is_paid
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / payment_status
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / recipient_company
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / sender_company
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
  2. Changed4 schema fields changed
    • addedOutput schema / properties / payment / properties / paid_at
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / payment / properties / payment_status_description
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / payment / properties / payment_status_label
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / properties / payment / required
      Previous value: -[
      -  "view",
      -  "protocol",
      -  "order_id",
      -  "request_id",
      -  "endpoint",
      -  "status",
      -  "payment_status",
      -  "is_paid",
      -  "price_usd",
      -  "currency",
      -  "mailpiece_type",
      -  "postcard_size",
      -  "order_complete_url"
      -]New value: +[
      +  "view",
      +  "protocol",
      +  "order_id",
      +  "request_id",
      +  "endpoint",
      +  "status",
      +  "payment_status",
      +  "payment_status_label",
      +  "payment_status_description",
      +  "paid_at",
      +  "is_paid",
      +  "price_usd",
      +  "currency",
      +  "mailpiece_type",
      +  "postcard_size",
      +  "order_complete_url"
      +]
  3. Changed6 schema fields changed
    • changedInput schema / properties / recipient_name / maxLength
      Previous value: -32New value: +255
    • changedInput schema / properties / sender_name / maxLength
      Previous value: -32New value: +255
    • addedOutput schema / properties / recipient_name / maxLength
      Added value: +255
    • addedOutput schema / properties / recipient_name / minLength
      Added value: +1
    • addedOutput schema / properties / sender_name / maxLength
      Added value: +255
    • addedOutput schema / properties / sender_name / minLength
      Added value: +1
  4. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnlyHint=false, destructiveHint=false, openWorldHint=true), and the description adds genuinely useful context beyond them: creation produces a draft and "never pays", and it enumerates what the draft response contains. It does not state permission/auth requirements or any rate limits, which keeps it short of a 5 for a 23-parameter order-creation tool.

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?

Front-loaded with the action and return shape, then the payment-path branches. Sentences are dense but each carries routing or behavioral information; the only slight redundancy is repeating MPP mechanics already implied by parameter descriptions.

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?

For a 23-parameter, nested-object tool with an output schema present, the description covers the orchestration an agent actually needs: what a draft is, what it costs (nothing yet), and which tool completes payment on each path. Address-resolution details are left to the schema, which is appropriate given full coverage, though auth expectations go unmentioned.

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 100%, so the schema already documents every parameter, including payment_protocol, buyer_email, and the address_type/address_id/manual combinations. The description's only added semantic is the coupling of payment_protocol=mpp with buyer_email, which the schema also states, so baseline 3 is correct.

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?

Opens with a specific verb and resource ("Prepare an existing PDF for mailing") and immediately names the return payload: order ID, total, hosted checkout URL, checkout session. The "existing PDF" framing distinguishes it from the letter/form draft siblings, and the explicit pointer to postalform.create_machine_order for x402 separates it from the machine-order variant.

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

Usage Guidelines5/5

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

Gives a full decision tree: default hosted checkout, pass a Stripe shared payment token to complete_checkout after buyer approval, or present the hosted URL; for MPP set payment_protocol=mpp plus buyer_email then call postalform.pay_order with the order_id; for x402 use postalform.create_machine_order. Each alternative is named with the condition that selects it, so no inference is required.

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