{
  "id": "mime-email-compose",
  "name": "Inert RFC email message composer",
  "description": "WHEN TO USE: Create exact inert .eml message text from caller-supplied From, ordered To, UTC timestamp, Message-ID, subject and text. Restricted ASCII mailboxes, deterministic MIME Base64 UTF-8 body and safe folded encoded subjects. Does not send email, create mailbox drafts, authenticate identities, look up domains or promise delivery.",
  "category": "structured",
  "priceUsd": "0.005",
  "pricingStatus": "proposed-unverified",
  "pricing": {
    "unit": "one successful operation call",
    "proposedNominalUsd": "0.005",
    "sixDecimalTokenBaseUnits": "5000",
    "subscription": false,
    "includesPayerWalletOrNetworkFees": false,
    "liveQuoteVerified": false,
    "condition": "Actual SDK challenge is authoritative only within the caller's explicit authorization; configured six-decimal token peg is an operator assertion, not a conversion guarantee."
  },
  "intents": [
    "Compose a complete deterministic .eml draft artifact for later caller-controlled import or transport",
    "Encode explicit sender, recipients, timestamp, message ID and plain text as an RFC MIME message"
  ],
  "whenToUse": [
    "Compose a complete deterministic .eml draft artifact for later caller-controlled import or transport",
    "Encode explicit sender, recipients, timestamp, message ID and plain text as an RFC MIME message"
  ],
  "whenNotToUse": [
    "Sending email, mailbox access, deliverability checks, DNS or authenticated sender identity",
    "HTML, attachments, display names, quoted mailboxes, groups, SMTPUTF8, Cc/Bcc, custom headers or DKIM",
    "Sending, uploading, extracting archives, writing files, authenticating identities, or changing external state"
  ],
  "capabilities": [
    "Profile rfc5322-text-message-v1; eight fixed headers and Base64 text/plain UTF-8",
    "Supplied whole-second UTC date and message ID; exact CRLF body normalization without adding decoded newlines",
    "Subject encoded words split only at scalar boundaries; literal encoded-word-looking text cannot become MIME syntax",
    "Deterministic supplied-input-only artifact; zero external requests and no current-time dependence"
  ],
  "limits": {
    "inputBytes": 100000,
    "outputBytes": 400000,
    "jsonNodes": 12000,
    "depth": 20,
    "profile": "rfc5322-text-message-v1",
    "recipients": 10,
    "mailboxBytes": 254,
    "localPartBytes": 64,
    "subjectScalars": 200,
    "subjectBytes": 600,
    "sourceBodyBytes": 40000,
    "canonicalBodyBytes": 40000,
    "wireBytes": 70000,
    "headerLineBytes": 998,
    "encodedWordSourceBytes": 42,
    "identities": "caller claims, not authenticated"
  },
  "related": [
    "multipart-form-encode",
    "icalendar-compose",
    "email-domain-readiness"
  ],
  "errorCodes": [
    "INPUT_LIMIT",
    "OUTPUT_LIMIT",
    "COMPLEXITY_LIMIT",
    "INVALID_JSON",
    "INVALID_NUMBER",
    "INVALID_UNICODE",
    "UNSAFE_KEY",
    "INVALID_MAILBOX",
    "INVALID_TIMESTAMP",
    "HEADER_CONTROL",
    "DUPLICATE_RECIPIENT",
    "SUBJECT_LIMIT",
    "SUBJECT_WHITESPACE",
    "BODY_CONTROL",
    "TEXT_LIMIT",
    "HEADER_LIMIT",
    "WIRE_LIMIT"
  ],
  "requirementsProfile": {
    "format": "declared-requirements-v1",
    "facts": {
      "execution.suppliedCode": false,
      "execution.remoteMutation": false,
      "execution.llmInference": false,
      "execution.paidMcp": false,
      "verification.semanticTruth": false,
      "verification.sourceAuthenticity": false,
      "verification.liveVulnerabilities": false,
      "numbers.arbitraryPrecisionJson": false,
      "numbers.model": "ieee754-binary64",
      "privacy.requestBodyPersisted": false,
      "execution.deterministic": true,
      "execution.networkAccess": false,
      "privacy.resultBodyPersisted": false,
      "payment.x402": true,
      "payment.mpp": true,
      "operation.id": "mime-email-compose",
      "operation.category": "structured",
      "limit.httpRequestBytes": 131072,
      "limit.requestBytes": 100000,
      "limit.responseBytes": 524288,
      "limit.resultBytes": 400000,
      "limit.jsonDepth": 20,
      "limit.jsonNodes": 12000,
      "mimeEmail.profile": "rfc5322-text-message-v1",
      "mimeEmail.maxRecipients": 10,
      "mimeEmail.maxSubjectScalars": 200,
      "mimeEmail.maxSubjectBytes": 600,
      "mimeEmail.maxBodyBytes": 40000,
      "mimeEmail.maxWireBytes": 70000,
      "mimeEmail.bodyType": "text/plain; charset=UTF-8",
      "mimeEmail.encoding": "base64",
      "mimeEmail.suppliedSenderDateMessageId": true,
      "mimeEmail.html": false,
      "mimeEmail.attachments": false,
      "mimeEmail.sendsMessage": false,
      "mimeEmail.mailboxAccess": false,
      "mimeEmail.senderAuthenticated": false,
      "mimeEmail.mailboxExistenceVerified": false,
      "input.from.maxLength": 254,
      "input.from.minLength": 3,
      "input.to.maxItems": 10,
      "input.to.minItems": 1,
      "input.sentAt.maxLength": 20,
      "input.sentAt.minLength": 20,
      "input.messageId.maxLength": 254,
      "input.messageId.minLength": 3,
      "input.subject.maxLength": 400,
      "input.text.maxLength": 40000
    },
    "unknownPolicy": "Undeclared requirements are unknown, never compatible. Matching declared facts does not establish semantic fit or input validity.",
    "preflight": "/preflight"
  },
  "documentation": "/reference/tools/mime-email-compose.md",
  "serviceContract": "/reference/services/mime-email-compose.json",
  "errors": [
    {
      "status": 400,
      "meaning": "Malformed JSON, missing/invalid idempotency key, or payment identifier mismatch",
      "retry": "Correct the request before payment"
    },
    {
      "status": 402,
      "meaning": "Payment challenge or rejected payment",
      "retry": "Use official protocol SDK; inspect payment outcome before another payment"
    },
    {
      "status": 409,
      "meaning": "Idempotency conflict, duplicate proof, or PAYMENT_UNCERTAIN",
      "retry": "Keep original key, body, and proof; reconcile uncertainty with operator; never blindly repay"
    },
    {
      "status": 413,
      "meaning": "Input or generated output too large",
      "retry": "Reduce input; no payment attempted for validation failure"
    },
    {
      "status": 415,
      "meaning": "Unsupported media type or compression",
      "retry": "Send uncompressed application/json"
    },
    {
      "status": 422,
      "meaning": "Schema or service-specific semantic validation failure",
      "retry": "Correct input using returned error code; no payment attempted"
    },
    {
      "status": 429,
      "meaning": "Request/payment-attempt rate exceeded",
      "retry": "Wait for rate limit window; preserve existing payment identity"
    },
    {
      "status": 503,
      "meaning": "Payment configuration/provider/state unavailable, or live DNS preparation failed before settlement",
      "retry": "Check readiness; DNS preparation failures may retry the identical key/body/credential only; uncertainty requires reconciliation"
    }
  ],
  "numericPrecision": "JavaScript IEEE-754 numbers; use strings for large integer IDs/exact decimals where the schema accepts strings. No lossless numeric parsing.",
  "paymentWorkflow": {
    "discoveryOnly": false,
    "supportedProtocols": [
      "x402",
      "mpp"
    ],
    "x402": {
      "credentialHeader": "PAYMENT-SIGNATURE",
      "challengeHeader": "PAYMENT-REQUIRED",
      "receiptHeader": "PAYMENT-RESPONSE",
      "version": 2,
      "scheme": "exact",
      "paymentIdentifier": "payment-identifier extension MUST equal the HTTP Idempotency-Key",
      "sdk": "@x402/core with @x402/evm"
    },
    "mpp": {
      "supported": true,
      "credentialHeader": "Authorization",
      "challengeHeader": "WWW-Authenticate",
      "receiptHeader": "Payment-Receipt",
      "method": "tempo",
      "intent": "charge",
      "sdk": "mppx",
      "tokenDecimals": 6
    },
    "steps": [
      "Check configured readiness and the exact service schema",
      "Generate a fresh random Idempotency-Key for this operation; never use a discovery probe fixture for purchases",
      "Send valid input without a credential to obtain the official protocol challenge",
      "Use the official SDK and authorized wallet to fulfill the challenge",
      "Retry only with identical key, body, protocol and credential",
      "On PAYMENT_UNCERTAIN stop and request operator reconciliation; never blindly pay again"
    ],
    "versionedRetries": "Request fingerprint includes service release version. Retries across a version upgrade can conflict; coordinate upgrades outside the 24-hour replay window and reconcile pending attempts.",
    "docs": "/llms.txt"
  },
  "method": "POST",
  "paths": {
    "x402": "/v1/x402/mime-email-compose",
    "mpp": "/v1/mpp/mime-email-compose"
  },
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "from": {
        "type": "string",
        "minLength": 3,
        "maxLength": 254
      },
      "to": {
        "minItems": 1,
        "maxItems": 10,
        "type": "array",
        "items": {
          "type": "string",
          "minLength": 3,
          "maxLength": 254
        }
      },
      "sentAt": {
        "type": "string",
        "minLength": 20,
        "maxLength": 20
      },
      "messageId": {
        "type": "string",
        "minLength": 3,
        "maxLength": 254
      },
      "subject": {
        "type": "string",
        "maxLength": 400
      },
      "text": {
        "type": "string",
        "maxLength": 40000
      }
    },
    "required": [
      "from",
      "to",
      "sentAt",
      "messageId",
      "subject",
      "text"
    ],
    "additionalProperties": false
  },
  "outputSchema": {
    "type": "object",
    "required": [
      "operation",
      "version",
      "result",
      "provenance"
    ],
    "properties": {
      "operation": {
        "const": "mime-email-compose",
        "type": "string"
      },
      "version": {
        "const": "0.29.0",
        "type": "string"
      },
      "result": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "eml": {
            "type": "string",
            "maxLength": 70000
          },
          "byteLength": {
            "type": "integer",
            "minimum": 1,
            "maximum": 70000
          },
          "canonicalText": {
            "type": "string",
            "maxLength": 40000
          }
        },
        "required": [
          "eml",
          "byteLength",
          "canonicalText"
        ],
        "additionalProperties": false
      },
      "provenance": {
        "type": "object",
        "required": [
          "inputSha256",
          "outputSha256",
          "deterministic",
          "externalRequests"
        ],
        "properties": {
          "inputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "outputSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "deterministic": {
            "const": true
          },
          "externalRequests": {
            "const": 0
          }
        }
      }
    },
    "additionalProperties": false
  },
  "exampleInput": {
    "from": "a@example.invalid",
    "to": [
      "b@example.invalid"
    ],
    "sentAt": "2026-10-05T00:00:00Z",
    "messageId": "demo@example.invalid",
    "subject": "Test",
    "text": "Oi\n"
  },
  "exampleResponse": {
    "operation": "mime-email-compose",
    "version": "0.29.0",
    "result": {
      "eml": "From: a@example.invalid\r\nTo: b@example.invalid\r\nDate: Mon, 05 Oct 2026 00:00:00 +0000\r\nMessage-ID: <demo@example.invalid>\r\nSubject: Test\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding: base64\r\n\r\nT2kNCg==\r\n",
      "byteLength": 245,
      "canonicalText": "Oi\r\n"
    },
    "provenance": {
      "inputSha256": "3f095540c31fbbb0c75d82e8d8f54fbceb17631950ed8c38ee5ab13214d1de60",
      "outputSha256": "ce2296649f70300609d6e02b285b90485aa4e22b3f73ea5eeb392d1d3c42b489",
      "deterministic": true,
      "externalRequests": 0
    }
  },
  "requiredHeaders": {
    "Content-Type": "application/json",
    "Idempotency-Key": "random 16–128 character operation identifier"
  },
  "fixedExample": "/reference/examples/mime-email-compose.json",
  "execution": {
    "deterministic": true,
    "externalRequests": 0,
    "maxExternalRequests": 0,
    "resultSnapshotPersisted": false,
    "fixedExampleIsIllustrativeSnapshot": false,
    "requiresPayment": true,
    "supportsMcpExecution": false
  },
  "releaseSnapshot": {
    "format": "static-release-reference-v1",
    "sourceVersion": "0.29.0",
    "sourceRegistrySha256": "a2b5ec09bf6c38b9d2879d746a4fded374f5928b445377b0270ef6aa8e6cac65",
    "generatedAt": "2026-10-06T15:38:00Z",
    "releaseAcceptance": "not-verified-by-generator",
    "runtimeReadiness": "not-evaluated",
    "livePaymentsVerified": false,
    "indexingVerified": false,
    "apiOrigin": null,
    "notice": "Build-time release reference. Runtime readiness, deployment, payment settlement and external indexing are not evaluated here. Prices are proposed; this file cannot authorize execution or payment."
  }
}
