Skip to main content
Glama

add_data_validation

Destructive

Configure data validation rules on Google Sheets ranges to enforce dropdowns, checkboxes, dates, numbers, or text constraints, with optional input messages and strict rejection of invalid entries.

Instructions

Set a data validation rule on a cell range — dropdown lists, checkboxes, or date/number/text constraints.

    Args:
        spreadsheet_id: The ID of the spreadsheet
        sheet: The name of the sheet
        range: A1 notation range to validate (e.g. "A2:A100")
        condition_type: One of the Sheets API's condition types:
            "ONE_OF_LIST" — dropdown of custom values (values = the list items)
            "ONE_OF_RANGE" — dropdown sourced from another range (values = one item, the
            source range in A1 notation, e.g. ["Sheet2!A:A"] — a leading "=" is added
            automatically if you omit it)
            "BOOLEAN" — checkbox (omit values for a plain TRUE/FALSE checkbox, or give
            two values for custom checked/unchecked labels)
            "NUMBER_GREATER", "NUMBER_GREATER_THAN_EQ", "NUMBER_LESS",
            "NUMBER_LESS_THAN_EQ", "NUMBER_EQ", "NUMBER_NOT_EQ" — one numeric value
            "NUMBER_BETWEEN", "NUMBER_NOT_BETWEEN" — two numeric values
            "DATE_EQ", "DATE_BEFORE", "DATE_AFTER", "DATE_ON_OR_BEFORE",
            "DATE_ON_OR_AFTER" — one date value, e.g. "2025-01-01"
            "DATE_BETWEEN", "DATE_NOT_BETWEEN" — two date values
            "DATE_IS_VALID" — no values; any parseable date passes
            "TEXT_CONTAINS", "TEXT_NOT_CONTAINS", "TEXT_EQ" — one text value
            "TEXT_IS_EMAIL", "TEXT_IS_URL" — no values
            "CUSTOM_FORMULA" — one formula string, e.g. "=A1>0"
        values: Condition values as plain strings — see condition_type above for
                how many each type expects. Numbers and dates are passed as
                strings; the Sheets API parses them per the cell's format.
        input_message: Optional help text shown when a user selects a cell in range.
        strict: If True (default), reject input that fails the rule. If False,
                show a warning but still allow it.
        show_custom_ui: If True (default), show the built-in dropdown/checkbox UI
                for condition types that support one (ONE_OF_LIST, ONE_OF_RANGE,
                BOOLEAN). Ignored by condition types with no UI (e.g. NUMBER_*,
                TEXT_*).

    Returns:
        Result of the batchUpdate operation.
    

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": {
      "spreadsheet_id": "<spreadsheet_id>",
      "sheet": "<sheet>",
      "range": "<range>",
      "condition_type": "<condition_type>"
    },
    "name": "add_data_validation"
  }
}

Input Schema

NameRequiredDescriptionDefault
rangeYes
sheetYes
strictNo
valuesNo
input_messageNo
condition_typeYes
show_custom_uiNo
spreadsheet_idYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.6

TDQS

A4.2/5.0
Behavior4/5

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

Goes beyond the destructiveHint annotation by explaining the strict flag's reject-vs-warn consequence, show_custom_ui's applicability and its silent no-op for NUMBER_*/TEXT_* types, and that the operation is a batchUpdate. It does not disclose the key destructive detail — whether existing validation rules in the range are replaced — which matters most given destructiveHint=true.

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 core action, then an Args block, then Returns. Length is driven almost entirely by the condition_type enumeration, which is necessary given the schema's lack of enums; there is little filler, though the enumeration format is dense enough that scanning it takes effort.

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?

For an 8-parameter mutation tool with 0% schema coverage, the description covers every parameter's meaning, value cardinality, and default behavior, and an output schema exists so return values need no explanation. What's missing is the write-over-existing-rules behavior (the destructive aspect) and any permission prerequisites.

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 0%, so the description carries the full load and does so thoroughly: every parameter is explained, and condition_type — which has no schema enum — is enumerated exhaustively with the exact value count each type expects (one/two/none), plus how dates, numbers, and range references are formatted. values' interpretation is tied back per condition type, and show_custom_ui's type-specific limits are spelled out.

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?

First sentence gives a specific verb ('Set a data validation rule'), the resource and scope ('on a cell range'), and concrete instantiations (dropdowns, checkboxes, date/number/text constraints). This is unmistakably different from the get_/clear_data_validation siblings without needing to name them.

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?

Usage context is implied by the range/condition_type framing, and the condition_type enumeration tells the agent exactly which mode to pick, but there is no explicit when-to-use vs. when-not guidance — nothing steering the agent toward this tool over batch_update or away from ranges that already carry validation.

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