Skip to main content
Glama
xlsx-for-ai

xlsx-for-ai

by senoff

xlsx_sort

Read-onlyIdempotent

Sort Excel rows by multiple columns in Excel-compatible order, with case-insensitive text and blanks last; optionally deduplicate by a column set and return row numbers or JSON.

Instructions

Use this when you need a multi-column sort in Excel's sort order (case-insensitive text, numbers before text before logicals, blanks last), optionally unique by a column set (Excel UNIQUE). output row_numbers returns the sheet rows in order; rows_handle writes the sorted rows as NDJSON to a new cache handle; json returns a page in the xlsx_read json shape.

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": {
      "file_path": "<file_path>",
      "by": "<by>"
    },
    "name": "xlsx_sort"
  }
}

Input Schema

NameRequiredDescriptionDefault
byYesSort keys: [{ column, direction? }]. direction defaults to asc.
limitNoMax rows to return (default 1000).
sheetNoSheet name (default: first sheet).
file_pathYesAbsolute path to the .xlsx file. Pass the path string AS-IS — do NOT read, open, or base64-encode the file; the client handles all file I/O. The base64 surface in this connector is OUTPUT-only (_meta.file_b64).
header_rowNoHeader row (1-based). 0 = treat row 1 as data, no header.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv4.3.1
    • addedInput schema / properties / by / description
      Added value: +"Sort keys: [{ column, direction? }]. direction defaults to asc."
    • removedInput schema / properties / by / maxItems
      Removed value: -8
    • removedInput schema / properties / file_b64
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / file_path
      Added value: +{
      +  "description": "Absolute path to the .xlsx file. Pass the path string AS-IS — do NOT read, open, or base64-encode the file; the client handles all file I/O. The base64 surface in this connector is OUTPUT-only (_meta.file_b64).",
      +  "type": "string"
      +}
    • addedInput schema / properties / header_row
      Added value: +{
      +  "description": "Header row (1-based). 0 = treat row 1 as data, no header.",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 1000,
      +  "description": "Max rows to return (default 1000).",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • removedInput schema / properties / options
      Removed value: -{
      -  "properties": {
      -    "header_row": {
      -      "minimum": 0,
      -      "type": "integer"
      -    },
      -    "limit": {
      -      "maximum": 1000,
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    "sheet": {
      -      "type": "string"
      -    }
      -  },
      -  "type": "object"
      -}
    • addedInput schema / properties / sheet
      Added value: +{
      +  "description": "Sheet name (default: first sheet).",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "by",
      -  "file_b64"
      -]New value: +[
      +  "file_path",
      +  "by"
      +]
  2. First observedv3.2.1

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the bar is lower, and the description still adds real value: the exact sort collation rules, the dedup behavior, and what each output channel produces. Two gaps remain — no statement of what happens to the cache handle written by rows_handle (lifetime, whether it is a side effect beyond a read-only call) and no pagination/truncation behavior relative to the default limit of 1000.

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?

A single front-loaded sentence with the use condition first and the mode list last; every clause is dense with content and there is no filler. It is slightly over-packed with semicolon-separated clauses, but nothing is redundant.

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 no output schema, the description correctly takes on the job of describing returns, sketching row_numbers, rows_handle NDJSON, and the json page shape. It is complete enough to call correctly except for the missing linkage between the mentioned output modes/dedup and actual parameters.

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 coverage is 100%, so `by`, `limit`, `sheet`, `file_path`, and `header_row` are already documented, making 3 the baseline. The description does add collation meaning to the sort keys, but it also advertises an "optionally unique by a column set" capability and three selectable output modes for which the input schema exposes no corresponding parameters — options the agent has no way to activate.

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?

Names a specific verb and resource ("multi-column sort") on .xlsx rows and immediately pins down the exact semantics: Excel's collation order (case-insensitive text, numbers before text before logicals, blanks last), optional dedup, and three output channels. It is clearly not xlsx_read, xlsx_filter, or xlsx_aggregate, so an agent can route to it from the description alone.

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?

"Use this when you need a multi-column sort" gives a clear triggering condition, and the three named output modes (row_numbers, rows_handle, json) help pick a mode. It stops short of naming alternatives or stating when-not to use it — e.g. nothing tells the agent to prefer xlsx_filter for row selection or xlsx_read for plain retrieval.

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