Skip to main content
Glama
KitchenSink4AI

io.github.nometalalchemist/kitchensink4xl

apply_edits

Apply multiple Excel edits atomically: validate all locations and operations before writing; if any edit is invalid, nothing changes, and a backup with verify-after-write restores the file on failure.

Instructions

Apply many addressed edits as ONE atomic batch. edits is a list of {op, location, ...}: set_value {value}, set_formula {formula}, clear {what: contents|formats|all}, write_range {data: 2D array}. location is any location object, including a stale-checked get_grid_view anchor.

Every location is resolved and every op validated BEFORE anything is written, so a single bad edit refuses the whole batch and the file stays byte-for-byte unchanged. The batch then takes ONE backup (prev/anchor slots in .ks4xl-backups), does ONE atomic save, and runs ONE verify-after-write, which restores from the backup if the produced file fails to read back as intended. Formula edits are normalized and flag recalculation; each write_range op honors the 200,000-cell ceiling. A hazardous workbook refuses unless allow_loss is true; refuses while the file is open in Excel. Returns the count of edits applied and cells touched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
editsYesEdits applied as ONE atomic batch: {op, location, ...}.
backupNo
allow_lossNo
verify_comNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.0
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. Changed4 schema fields changedv1.1.0
    • addedInput schema / properties / edits / description
      Added value: +"Edits applied as ONE atomic batch: {op, location, ...}."
    • addedInput schema / properties / edits / items / properties
      Added value: +{
      +  "data": {
      +    "description": "Rows of cell values, rectangular: every row the same length.",
      +    "items": {
      +      "items": {
      +        "anyOf": [
      +          {
      +            "type": "string"
      +          },
      +          {
      +            "type": "number"
      +          },
      +          {
      +            "type": "boolean"
      +          },
      +          {
      +            "type": "null"
      +          }
      +        ],
      +        "description": "A cell value: text, a number, a boolean, or null to clear. A string beginning with '=' is stored as a formula."
      +      },
      +      "type": "array"
      +    },
      +    "type": "array"
      +  },
      +  "formula": {
      +    "type": "string"
      +  },
      +  "location": {
      +    "anyOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "op": {
      +    "enum": [
      +      "set_value",
      +      "set_formula",
      +      "clear",
      +      "write_range"
      +    ],
      +    "type": "string"
      +  },
      +  "value": {
      +    "anyOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "type": "number"
      +      },
      +      {
      +        "type": "boolean"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "A cell value: text, a number, a boolean, or null to clear. A string beginning with '=' is stored as a formula."
      +  },
      +  "what": {
      +    "enum": [
      +      "contents",
      +      "formats",
      +      "all"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / edits / items / required
      Added value: +[
      +  "op",
      +  "location"
      +]
    • addedInput schema / properties / edits / items / type
      Added value: +"object"
  3. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

With only readOnlyHint=false in annotations, the description carries the behavioral burden and does so thoroughly. It discloses pre-validation before any write, single-backup and single-save semantics, verify-after-write with restore, formula recalculation, the 200,000-cell ceiling, hazardous-workbook refusal via allow_loss, Excel-lock refusal, and the returned counts.

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 dense but every sentence earns its place. It front-loads the purpose and op list, then layers atomicity, safety, limits, and return values in a logical order. There is no filler or redundant restatement.

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, sparse annotations, and no output schema, the description is remarkably complete. It tells the agent what happens on partial failure, how backups and verification work, what constraints apply, and what the return value reports, leaving no critical calling decision unexplained.

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 description coverage is only 20%, and the description compensates substantially by explaining the nested edits structure, each op's payload, location semantics (including stale-checked get_grid_view anchors), and allow_loss behavior. It does not explicitly describe the path, backup, or verify_com parameters, but the core complex parameter is well covered.

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 states a precise verb ('apply'), a specific resource ('edits'), and a defining characteristic ('ONE atomic batch'). It also enumerates the four op types, making the tool's scope unmistakable and clearly distinct from single-edit siblings like set_cell, write_range, and clear_range.

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?

The phrase 'many addressed edits as ONE atomic batch' clearly indicates when to use this tool: when multiple edits must commit together. It does not explicitly name alternatives such as set_cells or write_range or state when not to use it, so it stops short of a full when/when-not routing guide.

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