Skip to main content
Glama

Sort a range

sort_range

Sort rows within a specified Google Sheets range by one or more columns, preserving the header row by default.

Instructions

Sort rows within a range by one or more columns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rangeYesA1 range, e.g. "Sheet1!A1:D20", "'My Tab'!B:B", or a tab name
accountNoGoogle account to use: an email or unique part of one (e.g. "acme.com"). Default: the account that can open the spreadsheet, else the default account.
sort_byYes
has_headerNoKeep the first row of the range in place
spreadsheetYesGoogle Sheets link or spreadsheet ID. The name of a spreadsheet used with Sheets MCP before also works

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.1

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false and openWorldHint=true, so the safety profile is partly covered. The description adds nothing beyond its title: it does not say that cells are rewritten in place, how formulas/relative references behave after reordering, whether formatting travels with the rows, or that a header row is preserved by default.

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?

One clear sentence with the verb and scope front-loaded and no filler. Brevity is not the problem here; the sentence is simply carrying too little information for a mutating tool, but that is captured under other dimensions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Five parameters, no output schema, and an in-place mutation of user data: the description should cover header handling (has_header defaults to true), whether the range must be contiguous, and what the agent gets back. None of that is present, so an agent must infer the risky parts of the call from the schema alone.

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 description coverage is 80%, so the schema already documents range, account, sort_by.column and has_header. The phrase 'by one or more columns' loosely corresponds to the sort_by array but adds no syntax, ordering-priority, or tie-breaking detail, so this sits at the baseline rather than above it.

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?

States a specific verb (sort) and resource (rows within a range) plus the ordering input (one or more columns). It is understandable on its own, but it does nothing to distinguish itself from siblings such as set_filter, format_range, or batch_update, which could plausibly also be reached for when reshaping sheet data.

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 at all: nothing says whether this is preferable to filtering (set_filter) or a manual rewrite via write_range, no prerequisites (must the sheet be open, must the account have edit rights), and no warning about when not to call it.

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