Skip to main content
Glama

generate_spf

Read-onlyIdempotent

Build an SPF DNS TXT record that authorizes which servers may send mail for your domain. Specify include, IP, MX, or A mechanisms and a policy to control receiver behavior.

Instructions

Build an SPF (Sender Policy Framework) record — the DNS TXT record that lists which servers may send mail for a domain. Pass the senders as mechanisms: include for a provider's own SPF (Google Workspace is _spf.google.com, Microsoft 365 is spf.protection.outlook.com, SendGrid is sendgrid.net), ip4/ip6 for your own servers, plus useMx/useA to authorise the domain's own MX or A records. The policy decides what receivers do with mail from anywhere else: 'fail' (-all, the production choice), 'softfail' (~all, for testing), 'neutral', or 'pass' (+all, which authorises the entire internet and should never be published). SPF is limited to ten DNS-triggering terms during recursive evaluation. This pure builder counts direct mechanisms; include and redirect targets can add nested lookups, so validate the published record with check_spf before treating the count as final. Returns the record, direct lookup count, whether that direct count or the 255-character limit is exceeded, plain-language warnings, and the DNS entry to publish. Use check_spf to resolve and validate a live record, and flatten_spf only when an existing record is over the limit. Nothing is looked up or stored — this is computation only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
useANoAuthorise the domain's own A/AAAA records. Costs one DNS lookup.
useMxNoAuthorise the domain's MX hosts. Costs one DNS lookup.
policyNoWhat receivers do with everything else: fail (-all) for production, softfail (~all) while testing. Defaults to fail.
mechanismsNoSenders to authorise, in the order they should appear in the record

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.10.0

TDQS

A5/5.0
Behavior5/5

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

Annotations declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint=false, and the description aligns by stating 'Nothing is looked up or stored — this is computation only.' It adds critical behavioral context about the 10-lookup limit, nested lookups, and the fact that the direct count may not reflect final validation, all beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is thorough yet tightly organized: purpose first, then parameter explanation, then limitations and alternatives, and finally return values. Every sentence adds value, with no redundancy or filler. It is front-loaded with the core purpose and then layers details logically.

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 complex tool like SPF generation, the description covers everything an agent needs: what it returns (record, direct lookup count, limit flags, warnings, DNS entry), the 255-character and 10-lookup constraints, nested lookup caveats, and clear routing to sibling tools. No output schema exists, but the description compensates fully.

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

Parameters5/5

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

Schema coverage is 100%, but the description enriches every parameter: it explains what each mechanism type means (include, ip4/ip6, useMx/useA), gives concrete examples (Google Workspace, Microsoft 365, SendGrid), clarifies policy semantics (fail vs softfail vs pass), and warns about the ten-term limit. This goes far beyond the schema's property descriptions.

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 description clearly states the tool builds an SPF record, a DNS TXT record, and specifies its function. It distinguishes itself from siblings like check_spf and flatten_spf by naming them and their purposes, making it unambiguous which tool to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly states when to use this tool versus alternatives: use check_spf to validate a live record, and flatten_spf only when an existing record exceeds the limit. It also explains the policy options and the importance of validating the final record, giving clear context for when this builder is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.