Skip to main content
Glama

Route an email address to an agent

route_email_domain
DestructiveIdempotent

Choose which agent answers mail to an address, and who it answers.

    Replaces the selected email routing settings. Clearing the agent stops
    automatic replies; restoring it does not replay mail received in between.
    Setting ``email_agent_id`` together with ``clear_agent=True`` is an error.
    With ``email_agent_scope="anyone"``, a stranger can make the agent use its
    allowed tools. Mail without a passing DMARC result gets no reply.
    A custom domain must be verified with inbound and sending on.
    A field left out keeps its value, except that a new agent starts at ``"members"``.

    Returns the updated ``EmailDomainResponse`` as a dict, or
    ``{"error": "<message>"}``.
    

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "domain_id": "<domain_id>"
    },
    "name": "route_email_domain"
  }
}

Input Schema

NameRequiredDescriptionDefault
domain_idYesEmail identity ID, the ``id`` from ``list_email_domains``.
llm_modelNoThe calling agent's provider model ID, as shown in the client's model configuration when available. Recorded for analytics.
clear_agentNo``true`` stops the agent replying to this address's mail.
email_agent_idNoAgent that replies to inbound mail, from ``list_agents`` or ``create_agent``.
email_agent_scopeNoWho the agent answers: ``members`` (verified members of the workspace whose mail passes DMARC) or ``anyone`` (every sender whose mail passes DMARC and the spam checks). Omitted: the current scope stays; a newly set agent starts at ``members``.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / llm_model / description
      Previous value: -"Model ID of the calling agent. Optional. Recorded for analytics only."New value: +"The calling agent's provider model ID, as shown in the client's model configuration when available. Recorded for analytics."
  2. Changed4 schema fields changed
    • addedOutput schema / $defs
      Added value: +{
      +  "DnsRecordSchema": {
      +    "additionalProperties": true,
      +    "description": "One DNS record the tenant must publish for a sending domain.\n\nCovers DKIM CNAMEs, MAIL FROM MX, and SPF TXT records.",
      +    "properties": {
      +      "name": {
      +        "description": "DNS record name/host to publish (e.g. a CNAME's subdomain).",
      +        "title": "Name",
      +        "type": "string"
      +      },
      +      "priority": {
      +        "anyOf": [
      +          {
      +            "type": "integer"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "MX priority. Only present for type='MX'; null otherwise.",
      +        "title": "Priority"
      +      },
      +      "type": {
      +        "default": "CNAME",
      +        "description": "DNS record type: 'CNAME' (DKIM), 'MX' (MAIL FROM), or 'TXT' (SPF).",
      +        "enum": [
      +          "CNAME",
      +          "MX",
      +          "TXT"
      +        ],
      +        "title": "Type",
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "DNS record value to publish (e.g. a CNAME target or TXT content).",
      +        "title": "Value",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "value",
      +      "type",
      +      "priority"
      +    ],
      +    "title": "DnsRecordSchema",
      +    "type": "object"
      +  }
      +}
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "description": "Read view for an email domain.\n\nThe inbound-action fields (``inbound_enabled``, ``forward_to``,\n``forward_rate_per_hour``) surface what the row has configured for\nincoming mail.",
      +    "properties": {
      +      "created_at": {
      +        "description": "When this domain was added, ISO 8601 timestamp.",
      +        "format": "date-time",
      +        "title": "Created At",
      +        "type": "string"
      +      },
      +      "dns_records": {
      +        "description": "DNS records (DKIM, MAIL FROM MX, SPF) the tenant must publish to verify this domain.",
      +        "items": {
      +          "$ref": "#/$defs/DnsRecordSchema"
      +        },
      +        "title": "Dns Records",
      +        "type": "array"
      +      },
      +      "domain": {
      +        "description": "The DNS domain mail is sent from.",
      +        "title": "Domain",
      +        "type": "string"
      +      },
      +      "email_agent_id": {
      +        "anyOf": [
      +          {
      +            "format": "uuid",
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "The agent that answers mail to this address. Null when none does.",
      +        "title": "Email Agent Id"
      +      },
      +      "email_agent_scope": {
      +        "default": "members",
      +        "description": "Who the agent answers: 'members' or 'anyone'.",
      +        "enum": [
      +          "members",
      +          "anyone"
      +        ],
      +        "title": "Email Agent Scope",
      +        "type": "string"
      +      },
      +      "forward_rate_per_hour": {
      +        "anyOf": [
      +          {
      +            "type": "integer"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Configured cap on forwarded messages per hour, if set.",
      +        "title": "Forward Rate Per Hour"
      +      },
      +      "forward_to": {
      +        "anyOf": [
      +          {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Email addresses inbound mail is forwarded to, if inbound is enabled.",
      +        "title": "Forward To"
      +      },
      +      "id": {
      +        "description": "Unique identifier for this email domain.",
      +        "format": "uuid",
      +        "title": "Id",
      +        "type": "string"
      +      },
      +      "inbound_enabled": {
      +        "default": false,
      +        "description": "Whether this domain accepts and forwards inbound mail.",
      +        "title": "Inbound Enabled",
      +        "type": "boolean"
      +      },
      +      "kind": {
      +        "description": "'hail_mail' (Hail-hosted address) or 'custom' (your own domain).",
      +        "enum": [
      +          "hail_mail",
      +          "custom"
      +        ],
      +        "title": "Kind",
      +        "type": "string"
      +      },
      +      "local_prefix_name": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "Name prefix of a hail_mail address: the part after the '+'. A free name inside the workspace, such as a person or team. Null for kind='custom'.",
      +        "title": "Local Prefix Name"
      +      },
      +      "local_prefix_org": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "deprecated": true,
      +        "description": "Deprecated: use local_prefix_name. Same value.",
      +        "readOnly": true,
      +        "title": "Local Prefix Org"
      +      },
      +      "local_prefix_user": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "deprecated": true,
      +        "description": "Deprecated: use local_prefix_workspace. Same value.",
      +        "readOnly": true,
      +        "title": "Local Prefix User"
      +      },
      +      "local_prefix_workspace": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "Workspace prefix of a hail_mail address: the part before the '+'. It names the workspace, and one workspace only may hold it. Null for kind='custom'.",
      +        "title": "Local Prefix Workspace"
      +      },
      +      "mail_from_domain": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "Custom MAIL FROM domain, if configured. Null when using the provider default.",
      +        "title": "Mail From Domain"
      +      },
      +      "mail_from_status": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "Verification status of the custom MAIL FROM domain, if one is configured. Secondary to verification_status.",
      +        "title": "Mail From Status"
      +      },
      +      "organization_id": {
      +        "description": "Organization that owns this domain.",
      +        "format": "uuid",
      +        "title": "Organization Id",
      +        "type": "string"
      +      },
      +      "provider": {
      +        "description": "Email sending provider for this domain (currently always 'ses').",
      +        "title": "Provider",
      +        "type": "string"
      +      },
      +      "receive_ready": {
      +        "anyOf": [
      +          {
      +            "type": "boolean"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "default": null,
      +        "description": "True when the domain's published MX points at Hail's inbound host. Only populated by POST /{id}/verify on custom domains; null everywhere else.",
      +        "title": "Receive Ready"
      +      },
      +      "sends_enabled": {
      +        "default": true,
      +        "description": "Send switch for kind='custom' rows. False stops the domain from sending at all: it is skipped by default sender selection and a send that names it explicitly returns 422. Always true for hail_mail rows.",
      +        "title": "Sends Enabled",
      +        "type": "boolean"
      +      },
      +      "updated_at": {
      +        "description": "When this domain was last modified, ISO 8601 timestamp.",
      +        "format": "date-time",
      +        "title": "Updated At",
      +        "type": "string"
      +      },
      +      "verification_status": {
      +        "description": "'pending' (not yet verified), 'verified' (ready to send), or 'failed'.",
      +        "enum": [
      +          "pending",
      +          "verified",
      +          "failed"
      +        ],
      +        "title": "Verification Status",
      +        "type": "string"
      +      },
      +      "verified_at": {
      +        "anyOf": [
      +          {
      +            "format": "date-time",
      +            "type": "string"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "When the domain became verified, ISO 8601 timestamp. Null until it is.",
      +        "title": "Verified At"
      +      }
      +    },
      +    "required": [
      +      "id",
      +      "organization_id",
      +      "kind",
      +      "domain",
      +      "local_prefix_workspace",
      +      "local_prefix_name",
      +      "verification_status",
      +      "dns_records",
      +      "mail_from_domain",
      +      "mail_from_status",
      +      "provider",
      +      "verified_at",
      +      "inbound_enabled",
      +      "sends_enabled",
      +      "forward_to",
      +      "forward_rate_per_hour",
      +      "email_agent_id",
      +      "email_agent_scope",
      +      "created_at",
      +      "updated_at",
      +      "receive_ready",
      +      "local_prefix_user",
      +      "local_prefix_org"
      +    ],
      +    "title": "EmailDomainResponse",
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "error": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedOutput schema / title
      Removed value: -"route_email_domain_toolDictOutput"
  3. Changed1 schema field changed
    • addedInput schema / properties / llm_model
      Added value: +{
      +  "description": "Model ID of the calling agent. Optional. Recorded for analytics only.",
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and idempotentHint=true, but the description adds substantially more: the operation replaces selected routing settings, clearing is not reversible by replay, the conflicting-parameter error, and the security implication that scope="anyone" lets strangers invoke the agent's allowed tools. It also discloses the return shape, including the {"error": ...} failure form.

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?

The first sentence front-loads purpose and every following line carries a distinct constraint, so it is dense rather than padded. A few statements restate schema descriptions (scope values, clear_agent), keeping it just short of ideal tightness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive, multi-condition routing mutation, the description covers replacement semantics, irreversibility of clearing, parameter conflict errors, prerequisites, defaulting behavior, and the return contract even though an output schema exists. Nothing essential for a correct call is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline would be 3, but the description adds meaning the schema does not: partial-update semantics ('a field left out keeps its value'), the exception that a newly set agent defaults to "members", and the cross-field constraint between clear_agent and email_agent_id. It does not explain the analytics-only llm_model, but that is minor.

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?

The opening line states a specific verb and resource: choosing which agent answers mail to an email address, plus the audience scope. It is clearly distinct from siblings such as route_number (number routing) or update_agent (agent configuration), so an agent can select it without opening the 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 conditions for correct use: clear_agent stops replies, restoring does not replay missed mail, and setting email_agent_id with clear_agent=True is an error. It also states the DMARC and domain-verification prerequisites. It never names an explicit alternative tool or a 'use this instead of X when' rule, which keeps it short of a 5.

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.