{
  "$comment": "Pony tool definitions for the OpenAI function-calling format. Drop the contents of `tools` into your request. The authoritative description of this API is https://pony.email/llms.txt — if this file disagrees with it, that file is right. The same API is also mounted as five MCP tools at https://api.pony.email/mcp: get_plans and buy_plan need no key, send_email, get_email and get_usage take the API key in an Authorization header, and every POST must send Accept: application/json, text/event-stream.",
  "base_url": "https://api.pony.email",
  "auth": {
    "type": "bearer",
    "header": "Authorization",
    "note": "If you have no key, call send_email anyway: a 402 carries an x402 v2 quote in the PAYMENT-REQUIRED header, and purchase_plan turns a signed authorization into a key."
  },
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "list_plans",
        "description": "List every Pony plan with its USDC price, included sends, daily cap and window length. Unauthenticated. Call this before purchase_plan to learn the exact amount and receiving address to pay.",
        "parameters": { "type": "object", "properties": {}, "required": [] }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "purchase_plan",
        "description": "Buy a plan with x402. Pass the base64 PAYMENT-SIGNATURE payload of a signed EIP-3009 transferWithAuthorization. Returns an API key, the plan window and a verified sending address. Idempotent on (payer, nonce): replaying the same authorization returns the original key rather than charging again, so retrying a timed-out purchase is safe and correct.",
        "parameters": {
          "type": "object",
          "properties": {
            "plan": {
              "type": "string",
              "enum": ["pro", "scale"],
              "description": "Which plan to buy. Only pro and scale are sold; free is listed with a null price and cannot be obtained."
            },
            "payment_signature": {
              "type": "string",
              "description": "Base64 of the x402 v2 PaymentPayload, sent as the PAYMENT-SIGNATURE header."
            }
          },
          "required": ["plan", "payment_signature"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "send_email",
        "description": "Send one transactional email. Returns the message id. A 402 response means there is no active plan and the PAYMENT-REQUIRED header carries a quote; a 429 means a daily cap that resets on its own.",
        "parameters": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "description": "Sender address. Must be on a verified domain, or on the sending address the purchase returned."
            },
            "to": {
              "type": "array",
              "items": { "type": "string" },
              "description": "Recipients. At most 50 across to, cc and bcc."
            },
            "cc": { "type": "array", "items": { "type": "string" } },
            "bcc": { "type": "array", "items": { "type": "string" } },
            "reply_to": { "type": "array", "items": { "type": "string" } },
            "subject": { "type": "string" },
            "html": { "type": "string", "description": "HTML body. Supply html or text, or both." },
            "text": { "type": "string", "description": "Plain-text body. Supply html or text, or both." },
            "idempotency_key": {
              "type": "string",
              "description": "Sent as the Idempotency-Key header. Honoured for 24 hours. Always set this on a send you might retry; reusing it with different content is a 409."
            }
          },
          "required": ["from", "to", "subject"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "get_email",
        "description": "Fetch one message by id: status, attempts, last error and last event.",
        "parameters": {
          "type": "object",
          "properties": { "id": { "type": "string" } },
          "required": ["id"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "list_emails",
        "description": "List sent messages, newest first, with keyset pagination.",
        "parameters": {
          "type": "object",
          "properties": {
            "limit": { "type": "integer", "minimum": 1, "maximum": 100 },
            "status": {
              "type": "string",
              "enum": ["queued", "sending", "sent", "failed"]
            },
            "to": { "type": "string" },
            "subject": { "type": "string" },
            "before": { "type": "string", "description": "RFC3339 timestamp." },
            "since": { "type": "string", "description": "RFC3339 timestamp." }
          },
          "required": []
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "get_usage",
        "description": "Report sends spent against the current plan window, the daily counter, and when the window ends. The window is a fixed 30 days from purchase, not a calendar month, and nothing renews at the end of it.",
        "parameters": { "type": "object", "properties": {}, "required": [] }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "add_domain",
        "description": "Register a sending domain you control and return the four DNS records to publish. Only needed for volume beyond the included sending identity, since a purchase already provisions a verified address.",
        "parameters": {
          "type": "object",
          "properties": { "name": { "type": "string" } },
          "required": ["name"]
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "create_webhook",
        "description": "Register an endpoint for delivery events and return its signing secret. The secret is shown exactly once. Delivery is at-least-once; deduplicate on the Pony-Delivery-Id header.",
        "parameters": {
          "type": "object",
          "properties": {
            "url": { "type": "string" },
            "description": { "type": "string" },
            "event_types": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["delivered", "bounced", "complained", "opened", "rejected"]
              }
            }
          },
          "required": ["url", "event_types"]
        }
      }
    }
  ]
}
