Skip to main content
Glama

gmail.users.settings.filters.create

Create Gmail filters that match messages by criteria and apply actions like labeling or forwarding. Use it to automate inbox organization, up to 1,000 filters per account.

Instructions

Creates a filter. Note: you can only create a maximum of 1,000 filters. For more information, see Manage Gmail filters [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON Filter object accepting action, criteria, id; pass it via params or whole via body_file Siblings over the same resource: delete, get, list.

Input Schema

NameRequiredDescriptionDefault
queryNoExtra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe.
paramsNoParameter map merged into the request; typed parameters win.
userIdYes[URL path segment] User's email address. The special value "me" can be used to indicate the authenticated user.me
dry_runNoReturn the request that would be sent, without sending it.
body_fileNoRead the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON Filter object.
request_bodyNoRequest body of type Filter: pass it via `params` (merged into the built body) or whole via `body_file`.

Output Schema

NameRequiredDescriptionDefault
idNo
actionNo
criteriaNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / body_file / description
      Previous value: -"Read the request body from this file ('-' for stdin) instead of building one from the parameters."New value: +"Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON Filter object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type Filter: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "action": {
      +      "properties": {
      +        "addLabelIds": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        "forward": {
      +          "type": "string"
      +        },
      +        "removeLabelIds": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "criteria": {
      +      "properties": {
      +        "excludeChats": {
      +          "type": "boolean"
      +        },
      +        "from": {
      +          "type": "string"
      +        },
      +        "hasAttachment": {
      +          "type": "boolean"
      +        },
      +        "negatedQuery": {
      +          "type": "string"
      +        },
      +        "query": {
      +          "type": "string"
      +        },
      +        "size": {
      +          "type": "integer"
      +        },
      +        "sizeComparison": {
      +          "enum": [
      +            "unspecified",
      +            "smaller",
      +            "larger"
      +          ],
      +          "type": "string"
      +        },
      +        "subject": {
      +          "type": "string"
      +        },
      +        "to": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "id": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed3 schema fields changed
    • addedInput schema / properties / userId / default
      Added value: +"me"
    • changedInput schema / properties / userId / description
      Previous value: -"User's email address. The special value \"me\" can be used to indicate the authenticated user."New value: +"[URL path segment] User's email address. The special value \"me\" can be used to indicate the authenticated user."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "action": {
      +      "properties": {
      +        "addLabelIds": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        "forward": {
      +          "type": "string"
      +        },
      +        "removeLabelIds": {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "criteria": {
      +      "properties": {
      +        "excludeChats": {
      +          "type": "boolean"
      +        },
      +        "from": {
      +          "type": "string"
      +        },
      +        "hasAttachment": {
      +          "type": "boolean"
      +        },
      +        "negatedQuery": {
      +          "type": "string"
      +        },
      +        "query": {
      +          "type": "string"
      +        },
      +        "size": {
      +          "type": "integer"
      +        },
      +        "sizeComparison": {
      +          "enum": [
      +            "unspecified",
      +            "smaller",
      +            "larger"
      +          ],
      +          "type": "string"
      +        },
      +        "subject": {
      +          "type": "string"
      +        },
      +        "to": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "id": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the mutation nature ('creates or triggers a change'), the 1,000-filter cap, the readonly-profile refusal, and the return shape (API response resource as JSON). It omits auth requirements and what happens on validation failure, keeping it short of a 5.

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?

Front-loaded with the action, then constraints, return shape, and sibling routing. Some bracket notation ('[HTTP POST]', '—') adds visual noise, but every sentence contributes information.

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

Completeness4/5

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

Given no annotations, an output schema present, and fully described parameters, the description covers the mutation semantics, limits, and payload format. Minor gaps remain around auth and error behavior, but an agent has enough to call it correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents userId, dry_run, params, body_file and the nested Filter body. The description restates the body fields (action, criteria, id) and the params/body_file passthrough, adding little beyond the schema baseline.

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?

States a specific verb and resource ('Creates a filter') and explicitly differentiates from siblings over the same resource (delete, get, list). An agent can identify the operation 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 Guidelines3/5

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

Includes a hard constraint (max 1,000 filters) and a safety-profile condition (refused under --readonly), but never says when to choose create versus list/get to inspect existing filters, nor what criteria make a valid filter. Usage is implied rather than guided.

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

Deploy Server

Other Tools