Preview: SendMock has no stable release yet. These docs follow develop.

MCP reference

Email providers tools

sendmock_email_provider_create

Add an email provider, blank or copied from another.

Toolset email.

    InputTypeDescription
    namerequiredstring
    The new provider's name.Example: SSL Wireless
    keyrequiredstring
    Its key in /providers/<key>/... paths and on messages; lowercase, fixed after creation.Example: sslwireless
    start_fromstring
    A provider of the same area to copy, or null to start blank.Example: twilio

    Example call

    {
      "name": "sendmock_email_provider_create",
      "arguments": {
        "name": "SSL Wireless",
        "key": "sslwireless",
        "start_from": "twilio"
      }
    }

    Result: MessageProviderDefinition

    API
    POST/api/v1/emails/providers
    CLI
    sendmock email providers create
    In the app
    Mail > Providers > Add provider

    sendmock_email_provider_delete

    Remove a built-in (restorable) or delete a custom provider; its messages stay.

    Toolset email.

    • Destructive
    • Idempotent
    InputTypeDescription
    provider_keyrequiredstring
    The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio

    Example call

    {
      "name": "sendmock_email_provider_delete",
      "arguments": {
        "provider_key": "twilio"
      }
    }

    Result: nothing

    API
    DELETE/api/v1/emails/providers/{providerKey}
    CLI
    sendmock email providers delete <providerKey>
    In the app
    Mail > Providers > provider > Remove or Delete

    sendmock_email_provider_get

    One provider definition; secret credentials masked.

    Toolset email.

    • Read only
    InputTypeDescription
    provider_keyrequiredstring
    The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio

    Example call

    {
      "name": "sendmock_email_provider_get",
      "arguments": {
        "provider_key": "twilio"
      }
    }

    Result: MessageProviderDefinition

    API
    GET/api/v1/emails/providers/{providerKey}
    CLI
    sendmock email providers show <providerKey>
    In the app
    Mail > Providers > provider

    sendmock_email_provider_list

    Email providers, built in and custom, removed ones included.

    Toolset email.

    • Read only

    No inputs.

    Example call

    {
      "name": "sendmock_email_provider_list",
      "arguments": {}
    }

    Result: MessageProviderDefinition[]

    API
    GET/api/v1/emails/providers
    CLI
    sendmock email providers list
    In the app
    Mail > Providers

    sendmock_email_provider_preview

    Run a sample request through a definition: the message it would store and the answer it would give.

    Toolset email.

    • Read only
    InputTypeDescription
    provider_keyrequiredstring
    The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio
    providerrequiredMessageProviderInput
    The provider settings to run, saved or not.
    sample_requestProviderSampleRequest
    The request to run; the provider's example send when left out.

    Example call

    {
      "name": "sendmock_email_provider_preview",
      "arguments": {
        "provider_key": "twilio",
        "provider": {
          "key": "sendgrid",
          "name": "SendGrid",
          "accent": "#1a82e2",
          "is_enabled": true,
          "host": "api.sendgrid.com",
          "credentials": [
            {
              "name": "api_key",
              "value": "SG.test_key_123",
              "is_secret": true
            }
          ],
          "check_credentials": false,
          "operations": [
            {
              "kind": "send",
              "method": "POST",
              "path": "/v3/{domain}/messages",
              "request_format": "multipart"
            }
          ],
          "field_mapping": [
            {
              "part": "to",
              "source": "personalizations[0].to[*].email"
            }
          ],
          "validation_rules": [
            {
              "part": "to",
              "check": "required",
              "max_length": null,
              "error_kind": "missing_field"
            }
          ],
          "success_response": {
            "status": 202,
            "headers": [
              {
                "name": "X-Message-Id",
                "template": "{{ message.provider_id }}"
              }
            ],
            "body": "{\"id\": \"{{ message.provider_id }}\"}"
          },
          "error_responses": [
            {
              "kind": "missing_field",
              "status": 202,
              "headers": [
                {
                  "name": "X-Message-Id",
                  "template": "{{ message.provider_id }}"
                }
              ],
              "body": "{\"id\": \"{{ message.provider_id }}\"}"
            }
          ],
          "message_id_template": "<{{ uuid() }}@sendmock.local>",
          "callback_template_key": "sendgrid-event",
          "status_names": {
            "delivered": "delivered",
            "bounced": "bounce",
            "complained": "spamreport"
          },
          "outcome_error_codes": {
            "invalid_number": "21211",
            "unreachable": "30003"
          }
        }
      }
    }

    Result: MessageProviderPreview

    API
    POST/api/v1/emails/providers/{providerKey}/preview
    CLI
    sendmock email providers preview <providerKey>
    In the app
    Mail > Providers > provider > Preview

    sendmock_email_provider_reset

    Put a built-in provider back as shipped.

    Toolset email.

      InputTypeDescription
      provider_keyrequiredstring
      The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio

      Example call

      {
        "name": "sendmock_email_provider_reset",
        "arguments": {
          "provider_key": "twilio"
        }
      }

      Result: MessageProviderDefinition

      API
      POST/api/v1/emails/providers/{providerKey}/reset
      CLI
      sendmock email providers reset <providerKey>
      In the app
      Mail > Providers > provider > Reset to default

      sendmock_email_provider_restore

      Bring a removed built-in back as it was.

      Toolset email.

        InputTypeDescription
        provider_keyrequiredstring
        The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio

        Example call

        {
          "name": "sendmock_email_provider_restore",
          "arguments": {
            "provider_key": "twilio"
          }
        }

        Result: MessageProviderDefinition

        API
        POST/api/v1/emails/providers/{providerKey}/restore
        CLI
        sendmock email providers restore <providerKey>
        In the app
        Mail > Providers > Removed > Restore

        sendmock_email_provider_update

        Change a provider; 400 with the problems for template errors, bad paths or a path clash.

        Toolset email.

        • Idempotent
        InputTypeDescription
        provider_keyrequiredstring
        The email or SMS provider's key, e.g. sendgrid or twilio, from its providers list.Example: twilio
        keyrequiredstring
        The /providers/<key>/... path and the provider value stored on each message; lowercase, fixed after creation.Example: sendgrid
        namerequiredstring
        The provider's name, shown on messages and in pickers.Example: SendGrid
        accentrequiredstring
        #rrggbb, used on its badge.Example: #1a82e2
        is_enabledrequiredboolean
        Off providers answer nothing; their paths get SendMock's native 404.Example: true
        hoststring
        The provider's API host, used on the provider port to tell apart providers that share a path; null when not needed.Example: api.sendgrid.com
        credentialsrequiredProviderCredential[]
        The credentials your app is configured with.Example: [{"name":"api_key","value":"SG.test_key_123","is_secret":true}]
        check_credentialsrequiredboolean
        Off by default: any credentials are accepted. On: wrong ones get the provider's unauthorized answer.Example: false
        operationsrequiredProviderOperation[]
        The requests it answers.Example: [{"kind":"send","method":"POST","path":"/v3/{domain}/messages","request_format":"multipart"}]
        field_mappingrequiredProviderFieldMapping[]
        Where each part of a sent message is read from; anything else is kept as metadata.Example: [{"part":"to","source":"personalizations[0].to[*].email"}]
        validation_rulesrequiredProviderValidationRule[]
        The checks run on each send, in order.Example: [{"part":"to","check":"required","max_length":null,"error_kind":"missing_field"}]
        success_responserequiredProviderResponseTemplate
        The answer to a request that passes every check.
        error_responsesrequiredProviderErrorResponse[]
        The answer for each kind of error.Example: [{"kind":"missing_field","status":202,"headers":[{"name":"X-Message-Id","template":"{{ message.provider_id }}"}],"body":"{\"id\": \"{{ message.provider_id }}\"}"}]
        message_id_templaterequiredstring
        The provider's id for each message, a template.Example: <{{ uuid() }}@sendmock.local>
        callback_template_keystring
        The webhook template its status callbacks and inbound messages are sent with; null sends none.Example: sendgrid-event
        status_namesrequiredobject
        The provider's name for each SendMock status.
        outcome_error_codesrequiredobject
        SMS only: the provider's error code for each delivery outcome, so test numbers fail with its own codes.

        Example call

        {
          "name": "sendmock_email_provider_update",
          "arguments": {
            "provider_key": "twilio",
            "key": "sendgrid",
            "name": "SendGrid",
            "accent": "#1a82e2",
            "is_enabled": true,
            "credentials": [
              {
                "name": "api_key",
                "value": "SG.test_key_123",
                "is_secret": true
              }
            ],
            "check_credentials": false,
            "operations": [
              {
                "kind": "send",
                "method": "POST",
                "path": "/v3/{domain}/messages",
                "request_format": "multipart"
              }
            ],
            "field_mapping": [
              {
                "part": "to",
                "source": "personalizations[0].to[*].email"
              }
            ],
            "validation_rules": [
              {
                "part": "to",
                "check": "required",
                "max_length": null,
                "error_kind": "missing_field"
              }
            ],
            "success_response": {
              "status": 202,
              "headers": [
                {
                  "name": "X-Message-Id",
                  "template": "{{ message.provider_id }}"
                }
              ],
              "body": "{\"id\": \"{{ message.provider_id }}\"}"
            },
            "error_responses": [
              {
                "kind": "missing_field",
                "status": 202,
                "headers": [
                  {
                    "name": "X-Message-Id",
                    "template": "{{ message.provider_id }}"
                  }
                ],
                "body": "{\"id\": \"{{ message.provider_id }}\"}"
              }
            ],
            "message_id_template": "<{{ uuid() }}@sendmock.local>",
            "status_names": {
              "delivered": "delivered",
              "bounced": "bounce",
              "complained": "spamreport"
            },
            "outcome_error_codes": {
              "invalid_number": "21211",
              "unreachable": "30003"
            },
            "host": "api.sendgrid.com",
            "callback_template_key": "sendgrid-event"
          }
        }

        Result: MessageProviderDefinition

        API
        PATCH/api/v1/emails/providers/{providerKey}
        CLI
        sendmock email providers update <providerKey>
        In the app
        Mail > Providers > provider > Save provider