{
  "name": "mailer",
  "description": "Send real paper mail in Canada. Up to 5 A4 pages per envelope, $10 CAD standard, bulk packs from $6.50. Mail is irreversible once printed.",
  "base_url": "https://mailer.websystems.co",
  "auth": "Authorization: Bearer <test_ or live_ key>. Get a free sandbox key with get_sandbox_key.",
  "tools": [
    {
      "name": "get_pricing",
      "description": "Current prices, page limit and bulk credit packs. No auth.",
      "http": { "method": "GET", "path": "/v1/pricing" },
      "input_schema": { "type": "object", "properties": {} }
    },
    {
      "name": "get_sandbox_key",
      "description": "Create a free sandbox key. Letters sent with it are never printed, mailed or charged. Use it to test the flow end to end.",
      "http": { "method": "POST", "path": "/api/keys/test" },
      "input_schema": { "type": "object", "properties": {} }
    },
    {
      "name": "request_credit_purchase",
      "description": "Start buying credit for a live key. Returns a Stripe Checkout URL that a HUMAN must open and pay; the live key is then emailed to that human. Never try to pay on the human's behalf.",
      "http": { "method": "POST", "path": "/api/keys/checkout" },
      "input_schema": {
        "type": "object",
        "required": ["email"],
        "properties": {
          "email": { "type": "string", "description": "The human's email, where the live key is sent." },
          "pack_id": { "type": "string", "enum": ["single", "pack_25", "pack_100", "pack_500", "pack_2500"], "description": "single=$10, pack_25=$225, pack_100=$850, pack_500=$3750, pack_2500=$16250" }
        }
      }
    },
    {
      "name": "send_letter",
      "description": "Print and mail one envelope in Canada. IRREVERSIBLE once printed: confirm recipient, address and content with the human first unless they pre-authorized sending. Always supply idempotency_key; reuse it when retrying the same letter.",
      "http": { "method": "POST", "path": "/v1/letters", "content_type": "application/json", "idempotency_header": "Idempotency-Key" },
      "input_schema": {
        "type": "object",
        "required": ["pdf_base64", "to"],
        "properties": {
          "pdf_base64": { "type": "string", "description": "A4 PDF, 1 to 5 pages, up to 3 MB, base64." },
          "to": { "type": "object", "required": ["address_line1", "city", "province", "postal_code"], "properties": {
            "address_line1": { "type": "string", "description": "Recipient name and street, e.g. 'Jane Doe, 123 Maple St'" },
            "address_line2": { "type": "string" }, "city": { "type": "string" },
            "province": { "type": "string", "description": "2 letters, e.g. ON" }, "postal_code": { "type": "string", "description": "e.g. M5V 1J2" } } },
          "return_address": { "type": "object", "description": "Optional. Printed top-left. Must be an address the sender may use. Omit to use Websystems Inc.", "properties": {
            "name": { "type": "string" }, "address_line1": { "type": "string" }, "address_line2": { "type": "string" },
            "city": { "type": "string" }, "province": { "type": "string" }, "postal_code": { "type": "string" } } },
          "service_level": { "type": "string", "enum": ["standard", "tracked", "registered"], "default": "standard" }
        }
      }
    },
    {
      "name": "get_letter",
      "description": "Status of one letter: test, paid (queued for print), or mailed (with tracking_number for tracked and registered).",
      "http": { "method": "GET", "path": "/v1/letters/{id}" },
      "input_schema": { "type": "object", "required": ["id"], "properties": { "id": { "type": "integer" } } }
    },
    {
      "name": "get_balance",
      "description": "Credit balance of the calling key, in cents CAD. If send_letter returns 402, ask the human to top up via request_credit_purchase.",
      "http": { "method": "GET", "path": "/api/account" },
      "input_schema": { "type": "object", "properties": {} }
    }
  ]
}
