Skip to main content
Glama

sort_range

Sorts a specified Google Sheets range by one or more columns in ascending or descending order, organizing spreadsheet rows by selected column keys.

Instructions

Sort a range by one or more columns.

Args: spreadsheet_id: The ID of the spreadsheet sheet: The name of the sheet range: A1 notation range to sort (e.g. "A1:D100") sort_order: List of sort specs, each with: - "column_index": 0-based column index within the range - "order": "ASCENDING" (default) or "DESCENDING" If omitted, sorts by the first column ascending.

Returns: Result of the batchUpdate operation

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": {
      "spreadsheet_id": "<spreadsheet_id>",
      "sheet": "<sheet>",
      "range": "<range>"
    },
    "name": "sort_range"
  }
}

Input Schema

NameRequiredDescriptionDefault
rangeYes
sheetYes
sort_orderNo
spreadsheet_idYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.6

TDQS

B3.1/5.0
Behavior2/5

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

The only annotations are a title, so the description carries the full disclosure burden. 'Result of the batchUpdate operation' hints that this is a mutation, but the description never says the range's existing row order is overwritten in place, whether the change is reversible, or how rows are permuted relative to the range boundaries — all critical for a tool that rewrites user data.

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?

The one-line purpose is front-loaded, followed by a clean Args/Returns block. The only waste is the boilerplate 'The ID of the spreadsheet' / 'The name of the sheet' lines, which add nothing, but the sort_order explanation earns its space.

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

Completeness3/5

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

The output schema exists, so the Returns line is sufficient and needn't be expanded. For a destructive-in-practice mutation with zero annotation coverage, however, the description omits whether a header row is excluded from sorting, what happens to formulas referencing sorted cells, and whether the whole range must be contiguous — real gaps for a 4-parameter write tool.

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 0%, so the description must do all the work, and it largely does: it explains A1 notation with a concrete example for range, and fully specifies the sort_order structure including 0-based column_index, the ASCENDING/DESCENDING enum, and the first-column-ascending default. Only spreadsheet_id and sheet are given bare one-liners, which is acceptable since they are self-evident.

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 first line states a specific verb and resource — sort a range by one or more columns — which an agent can act on immediately. It does not distinguish itself from similarly named siblings like style_doc_range or delete_doc_range, but those clearly target a different resource, so the ambiguity is small.

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 statement about when sorting is preferable to rewriting values, no mention of whether the sheet must be the active/only target, and no prerequisites such as edit permissions. The only implicit guidance is the fallback default for sort_order, which is a parameter detail rather than usage context.

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

Deploy Server

Other Tools