Skip to main content
Glama

create_filter

Destructive

Automatically label and triage incoming Gmail messages by creating filters from search criteria, with an option to retroactively apply actions to existing mail.

Instructions

Create a Gmail filter: matching incoming mail automatically gets the given label actions. Give at least one criterion and at least one action. Actions are label add/remove only (labels by name or id; an unknown name in addLabels is auto-created). Common recipes: skip the inbox → removeLabels ['INBOX']; auto-mark-read → removeLabels ['UNREAD']; auto-trash → addLabels ['TRASH']; star → addLabels ['STARRED']; file under a label → addLabels ['Receipts']. A filter only affects mail arriving AFTER it's created; set applyToExisting:true to ALSO apply the same actions once to mail already in the mailbox (builds a Gmail search from the criteria and runs a bulk modify — same loose-index caveat as bulk_modify; up to maxMessages, default 1000). USE WHEN: setting up a persistent auto-triage rule (e.g. 'always archive + label newsletters from x'), optionally cleaning up the existing backlog too. NOTE: forwarding filters are intentionally not supported — mailwarden creates no send/exfiltration path. SIDE EFFECTS: adds a server-side rule affecting future mail (reversible via delete_filter); with applyToExisting also modifies existing messages. Requires gmail.settings.basic.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNo
fromNo
sizeNo
queryNo
subjectNo
addLabelsNo
maxMessagesNo
excludeChatsNo
negatedQueryNo
removeLabelsNo
hasAttachmentNo
sizeComparisonNo
applyToExistingNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
appliedYes
forwardNo
criteriaYes
addLabelIdsYes
removeLabelIdsYes
Behavior5/5

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

Beyond the annotations (destructiveHint=true, readOnlyHint=false), the description discloses substantial behavioral traits: it adds a server-side rule (reversible via delete_filter), modifies existing messages only when applyToExisting=true, requires the gmail.settings.basic scope, auto-creates unknown addLabels names, and only affects future mail by default. It also mentions the 'loose-index caveat' and maxMessages limit, which are not visible in 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 long but highly structured with labeled sections such as 'Common recipes', 'USE WHEN', 'NOTE', and 'SIDE EFFECTS'. Every sentence delivers actionable information—no fluff or repetition. The front-loaded definition and clear organization make it scannable despite its length.

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?

The description covers creation semantics, criteria/action requirements, timing semantics, existing-mail application, permission scope, unsupported features, and side effects. With an output schema present, return-value details are not needed. It is fully self-contained for a complex mutation tool, leaving no critical ambiguity.

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 description coverage is 0%, so the description carries the full burden. It specifies that at least one criterion and one action are required, explains special label semantics (INBOX, UNREAD, TRASH, STARRED), and details applyToExisting and maxMessages behavior. This adds meaning well beyond the raw parameter names and helps the agent construct valid invocations.

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 opens with a specific verb and resource: 'Create a Gmail filter: matching incoming mail automatically gets the given label actions.' It clearly distinguishes from sibling tools like delete_filter and bulk_modify by establishing that it creates a persistent server-side rule and focuses on label actions. The presence of concrete recipes further disambiguates what the tool does.

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?

The description explicitly states when to use the tool with 'USE WHEN: setting up a persistent auto-triage rule' and provides clear exclusions ('forwarding filters are intentionally not supported'). It also explains the alternative for existing mail via the applyToExisting caveat and references bulk_modify's behavior, giving the agent both when and when-not guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/csitte/mailwarden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server