Skip to main content
Glama

Set rules

set_rules
Idempotent

Define workbook validation rules that are checked on each value-changing write; passing rules that later fail trigger rollback, while existing failures never block edits.

Instructions

Replace the workbook's rules and check them once; later value-changing writes are checked automatically.

A write that makes a passing rule fail (or a failing one worse) is rolled back; rules already failing never block. Stored as ".rules.json". Each rule has an "id" plus one of: {"type": "cells_equal", "left": "S!B40", "right": "S!C40", "tolerance": 0.01} {"type": "cell_compare", "cell": "S!D4", "op": "<=", "value": 1000} (or "cell_ref") {"type": "column_check", "sheet": "Data", "expr": "Qty >= 0", "cell_range": "A1:F500"} {"type": "column_unique", "sheet": "Data", "column": "Invoice"} {"type": "not_empty", "range": "Data!A2:A500"} {"type": "no_new_errors"}

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": {
      "rules": "<rules>"
    },
    "name": "set_rules"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoFile path or preloaded name (list_configured_files). Omit if only one file is preloaded.
rulesYesRule objects, each with a unique id and a type (see tool description). An empty list removes all rules.
on_violationNo"rollback": undo a write that breaks a rule. "warn": keep it and report.rollback
on_unverifiableNoWhat to do when a rule cannot be checked (e.g. LibreOffice missing): "warn" or "rollback".warn

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.0

TDQS

A4.3/5.0
Behavior3/5

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

Annotations only declare openWorldHint=false and idempotentHint=true, and the description adds substantial context beyond them: rollback of a write that breaks a rule or worsens a failing one, the fact that already-failing rules never block, and the sidecar storage location "<file>.rules.json". However, the interaction between the on_violation/on_unverifiable settings and that default prose is left implicit, and the enforcement only applying to "value-changing writes" is a meaningful limitation stated without detail on which operations count.

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 semantic in sentence one, then the rollback contract, then the rule grammar — a sensible order. The rule-type block is long but earns its space because the rules parameter is otherwise untyped; minor cost is that the enforcement sentence and the JSON examples use different phrasings for the same concepts.

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?

For a mutation tool that installs persisted validation state, the description covers what changes, what happens on violation, storage location, and the full rule grammar; return shape is covered by the existing output schema and the on_violation/on_unverifiable enums are self-documenting in the schema. An agent can invoke this correctly without further information.

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 100%, so the baseline would be 3, but the description goes well beyond it: the rules array is free-form (additionalProperties: true) and the schema explicitly defers to "see tool description", which the description pays off with a concrete catalog of all six rule types and their field shapes (cells_equal, cell_compare, column_check, column_unique, not_empty, no_new_errors). That is exactly the meaning an agent cannot get from the structured schema.

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 sentence states a specific verb and resource ("Replace the workbook's rules") and immediately adds the scope of effect: rules are checked once now and enforced automatically on later value-changing writes. That scope statement is what separates it in practice from a pure validation sibling like check_rules, so an agent knows this tool mutates persisted rule state rather than just testing it.

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?

Usage context is clear: use it to install/replace rules, empty list removes all rules (in the schema), and later writes are gated automatically. What's missing is an explicit routing sentence naming the check-only alternative and the condition that selects it (e.g. "to validate without changing rules, use check_rules"), so the agent must infer that split.

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