Skip to main content
Glama

sheets.spreadsheets.values.batchClearByDataFilter

Clears values in spreadsheet ranges that match specified data filters while preserving formatting, validation, and other cell properties.

Instructions

Clears one or more ranges of values from a spreadsheet. For more information, see Read, write, and search metadata. The caller must specify the spreadsheet ID and one or more DataFilters. Ranges matching any of the specified data filters will be cleared. Only values are cleared -- all other properties of the cell (such as formatting, data validation, etc.) are kept [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 BatchClearValuesByDataFilterRequest object accepting dataFilters; pass it via params or whole via body_file Siblings over the same resource: append, batchClear, batchGet, batchGetByDataFilter, batchUpdate, batchUpdateByDataFilter, clear, get, update.

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.
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 BatchClearValuesByDataFilterRequest object.
request_bodyNoRequest body of type BatchClearValuesByDataFilterRequest: pass it via `params` (merged into the built body) or whole via `body_file`.
spreadsheetIdYes[URL path segment] The ID of the spreadsheet to update.

Output Schema

NameRequiredDescriptionDefault
clearedRangesNo
spreadsheetIdNo

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 BatchClearValuesByDataFilterRequest object."
    • addedInput schema / properties / request_body
      Added value: +{
      +  "description": "Request body of type BatchClearValuesByDataFilterRequest: pass it via `params` (merged into the built body) or whole via `body_file`.",
      +  "properties": {
      +    "dataFilters": {
      +      "items": {
      +        "properties": {
      +          "a1Range": {
      +            "type": "string"
      +          },
      +          "developerMetadataLookup": {
      +            "properties": {
      +              "locationMatchingStrategy": {
      +                "enum": [
      +                  "DEVELOPER_METADATA_LOCATION_MATCHING_STRATEGY_UNSPECIFIED",
      +                  "EXACT_LOCATION",
      +                  "INTERSECTING_LOCATION"
      +                ],
      +                "type": "string"
      +              },
      +              "locationType": {
      +                "enum": [
      +                  "DEVELOPER_METADATA_LOCATION_TYPE_UNSPECIFIED",
      +                  "ROW",
      +                  "COLUMN",
      +                  "SHEET",
      +                  "SPREADSHEET"
      +                ],
      +                "type": "string"
      +              },
      +              "metadataId": {
      +                "type": "integer"
      +              },
      +              "metadataKey": {
      +                "type": "string"
      +              },
      +              "metadataLocation": {
      +                "properties": {
      +                  "dimensionRange": {
      +                    "type": "object"
      +                  },
      +                  "locationType": {
      +                    "enum": [
      +                      "DEVELOPER_METADATA_LOCATION_TYPE_UNSPECIFIED",
      +                      "ROW",
      +                      "COLUMN",
      +                      "SHEET",
      +                      "SPREADSHEET"
      +                    ],
      +                    "type": "string"
      +                  },
      +                  "sheetId": {
      +                    "type": "integer"
      +                  },
      +                  "spreadsheet": {
      +                    "type": "boolean"
      +                  }
      +                },
      +                "type": "object"
      +              },
      +              "metadataValue": {
      +                "type": "string"
      +              },
      +              "visibility": {
      +                "enum": [
      +                  "DEVELOPER_METADATA_VISIBILITY_UNSPECIFIED",
      +                  "DOCUMENT",
      +                  "PROJECT"
      +                ],
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "gridRange": {
      +            "properties": {
      +              "endColumnIndex": {
      +                "type": "integer"
      +              },
      +              "endRowIndex": {
      +                "type": "integer"
      +              },
      +              "sheetId": {
      +                "type": "integer"
      +              },
      +              "startColumnIndex": {
      +                "type": "integer"
      +              },
      +              "startRowIndex": {
      +                "type": "integer"
      +              }
      +            },
      +            "type": "object"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / spreadsheetId / description
      Previous value: -"The ID of the spreadsheet to update."New value: +"[URL path segment] The ID of the spreadsheet to update."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "clearedRanges": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "spreadsheetId": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well: it declares the operation is mutating (HTTP POST, 'creates or triggers a change'), is refused under --readonly safety profiles, and preserves non-value cell properties like formatting and data validation. It does not discuss reversibility or partial-failure behavior, but the destructive-scope disclosure is solid.

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 core behavior is front-loaded in the first three sentences, but the tail mixes meta-information (HTTP verb, safety profile, return format, body plumbing, sibling list) into a dense run of sentences. Every element is useful, but the block is scannable only after a full read.

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?

An output schema exists, so return-value explanation isn't needed, and parameter coverage is complete. For a mutating batch operation, the description supplies the scope of destruction, safety-profile behavior, and body-supply paths — enough to invoke correctly; only idempotency/error semantics are absent.

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 is 3; the description goes slightly beyond by naming the required inputs (spreadsheetId, dataFilters) and explaining how the body is supplied — as a BatchClearValuesByDataFilterRequest via `params` or whole via `body_file`. It doesn't explain the dataFilter variants (a1Range vs gridRange vs developerMetadataLookup), which the schema only structures.

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 ('Clears one or more ranges of values from a spreadsheet') and immediately distinguishes the mechanism: clearing is driven by DataFilters rather than literal ranges, which separates it from batchClear. The closing sibling list makes the distinction explicit.

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 a clear precondition ('The caller must specify the spreadsheet ID and one or more DataFilters') and the matching rule ('Ranges matching any of the specified data filters will be cleared'). What's missing is explicit routing advice — e.g., use batchClear when you already have A1/GridRanges — even though the siblings are named.

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