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.

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.
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.
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
paymentNo
order_idYes
price_usdYes
page_countYes
preview_urlNo
sender_nameYes
checkout_urlYes
recipient_nameYes
checkout_sessionNo
payment_protocolNo
sender_address_textYes
recipient_address_textYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +]
  2. 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
  3. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: 'Draft creation never pays', the draft-then-approve-then-complete sequence, and the fact that MPP mode returns a PDF preview, a hosted checkout_url fallback, and a challenge. Annotations only declare it is non-read-only, non-destructive, and open-world, so the no-charge guarantee and the handoff to complete_checkout/pay_order are the crucial additions. Pricing, expiration of the checkout session, and permission requirements are not covered.

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 purpose and return values, with each subsequent sentence dedicated to one payment path. It is a dense single block covering three flows, so it stays serviceable but would read better split into short path-specific statements.

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 21-parameter tool with nested PDF and address objects, an output schema, and 100% schema coverage, the description supplies what the structured fields cannot: the payment lifecycle and the sibling routing. Address-type selection and certified-mail variations are left entirely to schema descriptions, which is acceptable given their coverage.

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 per-parameter meanings are already documented, and the description largely restates the payment_protocol=mpp plus buyer_email pairing that the schema itself declares. It does tie the two parameters into a workflow (MPP challenge for the same prepared order), which is a small addition over the schema but not enough to exceed baseline.

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?

States a specific verb and resource ('Prepare an existing PDF for mailing' / create order draft) and enumerates what is returned (order ID, total, hosted checkout URL, checkout session). It also explicitly routes the x402 case to postalform.create_machine_order, so an agent can separate it from that sibling without opening a 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?

Gives concrete when-to-use branching: hosted checkout by default, complete_checkout if a Stripe shared payment token is available, payment_protocol=mpp plus postalform.pay_order for MPP, and create_machine_order for x402. It does not distinguish this tool from the other draft creators in the family (create_letter_order_draft, create_form_order_draft), which is the remaining ambiguity for document-type selection.

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