Skip to main content
Glama

addConditionalFormatting

Apply conditional formatting rules to spreadsheet ranges so cells automatically change style—background, bold, or text color—when values meet numeric, blank, or custom-formula conditions.

Instructions

Adds a conditional formatting rule to one or more ranges in a spreadsheet. Applies a format (background color, bold, text color, etc.) when cells meet a specified condition. Use CUSTOM_FORMULA for complex conditions like "=$A1>$B1". Note: each call appends a new rule — use deleteConditionalFormatting to remove existing rules before re-adding.

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": {
      "spreadsheetId": "<spreadsheetId>",
      "ranges": "<ranges>",
      "conditionType": "<conditionType>"
    },
    "name": "addConditionalFormatting"
  }
}

Input Schema

NameRequiredDescriptionDefault
boldNoApply bold text formatting.
italicNoApply italic text formatting.
rangesYesOne or more A1 notation ranges the rule applies to (e.g., ["B2:S68"] or ["A1:A10", "C1:C10"]).
fontSizeNoFont size in points.
sheetNameNoName of the sheet/tab. Defaults to the first sheet if not provided.
underlineNoApply underline text formatting.
conditionTypeYesThe condition type. NUMBER_* types compare cell values numerically. CUSTOM_FORMULA evaluates a formula (e.g., "=$A1>10"). BLANK/NOT_BLANK check whether a cell is empty.
spreadsheetIdYesThe spreadsheet ID — the long string between /d/ and /edit in a Google Sheets URL.
strikethroughNoApply strikethrough text formatting.
backgroundColorNoCell background color as hex (e.g., "#FF9900").
conditionValuesNoValues for the condition. Omit or pass [] for BLANK and NOT_BLANK. Pass one value for all NUMBER_* single-operand types and CUSTOM_FORMULA. Pass two values for NUMBER_BETWEEN and NUMBER_NOT_BETWEEN (lower bound first).
foregroundColorNoText (foreground) color as hex (e.g., "#FF0000").

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.0.0-rc.1

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full disclosure burden, and it steps up on the most important non-obvious trait: each call appends a new rule rather than replacing one, making the operation non-idempotent and pointing at the destructive follow-up tool. It still omits permission/auth requirements and what the call returns, so it is strong but not complete.

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?

Three sentences, each earning its place: what it does, how conditions are expressed, and the append/dedup caveat. The critical non-idempotency warning is placed last but is short and unmissable.

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 a 12-parameter, unannotated, no-output-schema mutation tool, the description covers purpose, condition selection, and the append behavior that would otherwise cause silent duplicate rules. Remaining gaps — permissions and return value — are modest given the schema's thorough parameter documentation.

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 every one of the 12 parameters is already documented in the schema, including the conditionType enum and conditionValues cardinality rules. The description's only parameter-adjacent statement is the CUSTOM_FORMULA tip, which largely repeats the enum description; baseline 3 applies.

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 — 'Adds a conditional formatting rule to one or more ranges in a spreadsheet' — and immediately scopes what the rule does (applies a format when cells meet a condition). An agent can distinguish this from sibling formatting/read tools like getFormatting or copyFormatting 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 Guidelines4/5

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

It gives concrete routing advice: use CUSTOM_FORMULA for complex conditions such as "=$A1>$B1", and it names deleteConditionalFormatting as the tool to call before re-adding since this one appends. That is real when-to-use guidance, though it does not cover when not to use this tool versus the sibling formatting tools.

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