Skip to main content
Glama

heap_sort

Sort an array of numbers in place using the heap sort algorithm, guaranteeing O(n log n) time and returning the swap count.

Instructions

Sort numbers using the heap sort algorithm. Guaranteed O(n log n) in-place sorting with swap count.

Input Schema

NameRequiredDescriptionDefault
arrayYesArray of numbers to sort

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden. It does add useful traits — the O(n log n) guarantee and in-place operation — but the trailing 'with swap count' is ambiguous (does the tool return a swap count, or just count swaps internally?), and stability, mutation vs. copy semantics, and return shape are unstated.

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?

Two tight sentences with the core action front-loaded and the algorithmic property appended. The final clause is slightly under-specified, but there is no padding.

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?

For a single-parameter pure computation tool with no output schema or annotations, the description is serviceable but leaves the return value ambiguous and omits edge-case behavior. It is minimally adequate rather than complete.

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?

One parameter with 100% schema description coverage, so the baseline is 3. The description adds no meaning about the array parameter (e.g., numeric-only, NaN handling, empty-array behavior) beyond what the schema already says.

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 states a specific verb and resource ('Sort numbers') and pins the algorithm ('heap sort'), which distinguishes it from generic sorts. It does not explicitly contrast with sibling algorithm variants (bucket_sort, radix_sort, counting_sort), but the named algorithm does most of the differentiating work.

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 guidance on when to prefer heap sort over the many sibling sorting tools, nor any stated preconditions on input. The agent must infer suitability from the complexity claim alone.

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