Skip to main content
Glama
Matthew3957

ai-toolkit

by Matthew3957

set_sheet_conditional_formats

Apply conditional formatting rules to a Google Sheets tab so whole rows recolor by formula when status text changes. Replaces prior rules with the same tag, leaving manually added formats untouched.

Instructions

Colour whole rows by rule, as conditional formatting keyed on a formula.

Use this to colour-code a tracker by a status column rather than painting cells once: the sheet recolours itself whenever the status text changes, and nobody has to remember to repaint. Each rule in rules is {"formula": ..., "background": ..., "foreground": ...} where formula is a Sheets custom formula written for the first data row, e.g. REGEXMATCH(LOWER($D2), "^applied") (no leading =; $D2 means column D of whichever row is being tested), and background / foreground are hex colours like "#FFF3A0" (either may be omitted). Rules are evaluated in order and the first true one paints the row, so put the most specific (for example "closed" or "rejected") first.

Every rule this tool writes carries tag inside its formula, and a later call with the same tag deletes those rules before adding the new set, so the call is idempotent and never touches rules a person added by hand. Use a distinct tag per scheme if one tab carries two. Rules apply to every column from first_row (1-based, default 2 to skip a header) to the bottom of the grid.

sheet_id is the spreadsheet's ID (from its URL) and is required. tab is the worksheet title (see list_sheet_tabs). Returns a summary of rules removed and added.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabYes
tagNoai-toolkit
rulesYes
sheet_idYes
first_rowNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so thoroughly. It discloses idempotency via tag, deletion of previous tagged rules, preservation of hand-added rules, rule evaluation order, and the row range affected. This is exactly the kind of side-effect transparency needed for a mutation tool.

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 every sentence earns its place; the tool is genuinely complex. It is well-structured: purpose, use case, rule syntax, idempotency behavior, and parameter explanations are separated logically. The opening sentence front-loads the core function.

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?

Given the tool's complexity, the description is complete: it covers all five parameters, the rule schema, ordering semantics, idempotency, the range affected, and even the return value. The output schema exists for return details, so the description does not need to repeat those. An agent has enough to invoke this tool correctly.

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 must fully compensate, and it does. It explains rules structure with formula/background/foreground semantics, gives a concrete formula example, describes tag behavior, and defines sheet_id, tab, and first_row defaults. Every parameter is given practical meaning.

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 opening line states a specific verb and resource: 'Colour whole rows by rule, as conditional formatting keyed on a formula.' It also distinguishes itself from cell-painting approaches, which separates it from siblings like update_sheet_range without needing to read 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 Guidelines5/5

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

The description gives an explicit use case: 'Use this to colour-code a tracker by a status column rather than painting cells once,' and explains why it is preferable. It also references list_sheet_tabs for resolving tab names, providing routing guidance to a sibling tool.

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