Skip to main content
Glama

Autofit columns

autofit_columns
Idempotent

Adjusts each spreadsheet column width to fit its longest value, constrained by minimum and maximum limits, so cells display fully without manual resizing.

Instructions

Set each column's width to fit its longest value, within min_width..max_width.

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": {
      "sheet": "<sheet>"
    },
    "name": "autofit_columns"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoFile path or preloaded name (list_configured_files). Omit if only one file is preloaded.
sheetYesSheet name (case-sensitive).
backupNoSave a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true).
reasonNoWhy; kept in the change log (XLSX_MCP_CHANGE_LOG=true).
paddingNoCharacters added to the longest value.
max_widthNoWidest width, in characters.
min_widthNoNarrowest width, in characters.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.4.0
    • addedInput schema / properties / backup / description
      Added value: +"Save a .bak copy first. Default: XLSX_MCP_AUTO_BACKUP (true)."
    • addedInput schema / properties / max_width / description
      Added value: +"Widest width, in characters."
    • addedInput schema / properties / min_width / description
      Added value: +"Narrowest width, in characters."
    • addedInput schema / properties / padding / description
      Added value: +"Characters added to the longest value."
    • addedInput schema / properties / path / description
      Added value: +"File path or preloaded name (list_configured_files). Omit if only one file is preloaded."
    • addedInput schema / properties / reason
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Why; kept in the change log (XLSX_MCP_CHANGE_LOG=true).",
      +  "title": "Reason"
      +}
    • addedInput schema / properties / sheet / description
      Added value: +"Sheet name (case-sensitive)."
  2. Addedv0.3.0

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare idempotentHint=true, destructiveHint=false, and openWorldHint=false, so the safety profile is covered. The description adds genuine behavioral detail by stating that widths are clamped into the min_width..max_width range rather than sized purely to content. It does not disclose how empty columns, merged cells, or previously fixed widths are handled, nor that the workbook file is rewritten.

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?

A single front-loaded sentence with zero filler: verb, scope, and the clamping constraint in one pass. Nothing could be removed without losing meaning.

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?

With an output schema, full annotation coverage, and 100% parameter documentation, the description only needs to carry the core behavior, which it does. The remaining gap is edge-case behavior on merged or empty columns, which an agent might reasonably want before committing the change.

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 coverage is 100%, so the baseline is 3, but the description adds meaning by linking min_width and max_width as the bounding range applied to the computed fit value rather than leaving them as two independent integers. It says nothing extra about padding, backup, or reason, all of which the schema already documents.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource ('Set each column's width') and defines the behavior precisely as fitting the longest value. It is unambiguous what the tool does, though it does not name any sibling (e.g., set_cell_style) to contrast with, which is the only thing separating a 4 from a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

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

There is no when-to-use guidance, no prerequisites, and no statement of when a different tool would be preferable (e.g., setting a fixed width via set_cell_style). The only contextual signal is the clamping rule, which describes mechanics rather than selection criteria.

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