Skip to main content
Glama

cartesian_tree

Builds a Cartesian tree from a numeric array, preserving min-heap order by value and BST order by index.

Instructions

Build a Cartesian tree from an array (min-heap ordered with BST on indices).

Input Schema

NameRequiredDescriptionDefault
arrayYesInput array of numbers

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full disclosure burden. It states the structural invariant but says nothing about how the resulting tree is returned, how duplicates or empty input are handled, or typical complexity/limits for large arrays. For a pure algorithmic tool with zero annotation coverage, this leaves meaningful behavioral questions unanswered.

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?

A single short sentence that front-loads the action and resource, with the parenthetical definition placed where it is most useful. Nothing is wasted and nothing is buried.

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?

There is no output schema, so the description would ideally explain the return shape (e.g., how the tree is serialized) and any input constraints. It conveys the algorithmic goal but omits the result format, leaving the agent partially informed for a computation tool.

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?

With a single parameter at 100% schema description coverage, the schema already documents the 'array' input as an array of numbers, so the baseline is 3. The description confirms the input is an array but adds no syntax, ordering, or edge-case detail beyond what the schema provides.

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 gives a specific verb ('Build') and resource ('Cartesian tree') and pins down the defining property: min-heap ordered with BST on indices. That is a precise, self-contained statement of purpose. It does not, however, distinguish itself from nearby algorithmic siblings such as 'treap_sim', 'avl_tree', or 'segment_tree', leaving the agent to rely on the name alone.

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 indication of when to reach for this tool versus the many other tree/data-structure utilities in the sibling list, and no preconditions or exclusions are stated. The agent must infer usage purely from the tool name and the one-line description.

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