Skip to main content
Glama

sort_data

Sort rows in an Excel worksheet by one or more columns, in ascending or descending order, and write the sorted result back to the original sheet, optionally using a header row.

Instructions

Sort worksheet rows by one or more columns and write back the result.

Args: file_path: Workbook path. sheet_name: Worksheet to sort. sort_by: List of sort descriptors, each with 'column' (str) and optional 'ascending' (bool, default True). column: Convenience single-column sort (deprecated in favour of sort_by). ascending: Boolean default sort order when column is used. has_header: Whether the sheet has a header row.

Returns: str: Result message.

Notes: - Destructive: overwrites sheet rows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnNo
sort_byNo
ascendingNo
file_pathYes
has_headerNo
sheet_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden. It explicitly warns 'Destructive: overwrites sheet rows' and states 'write back the result', giving clear behavioral transparency about the mutation. It does not mention permissions or side effects on formulas, but the destructive nature is disclosed.

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 well-structured with Args, Returns, and Notes sections. Every sentence adds value, and the format is easy to parse. It is appropriately sized for the tool's complexity.

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?

The description covers all necessary context: parameters, return type, and destructive behavior. An output schema is provided, so return values need no further explanation. The tool's complexity (multi-column sorting, deprecated parameter) is fully addressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no descriptions for top-level parameters (0% coverage), but the description's Args section comprehensively explains each parameter, including the nested structure of sort_by and the deprecation of column. This fully compensates for the schema gap.

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 uses a specific verb ('Sort') and resource ('worksheet rows'), clearly distinguishing it from sibling tools like filter_data_advanced or aggregate_data. The purpose is unambiguous and directly states the operation.

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

Usage Guidelines3/5

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

The description implies when to use the tool (when sorting worksheet rows is needed) but does not explicitly compare it to alternatives or mention conditions for exclusion. It provides no guidance on when to prefer this over other data manipulation tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mbeps/excel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server