Skip to main content
Glama

Topological order (safe change order)

codetopo_topo_sort
Read-only

Compute a safe dependency order for code-schema groups, returning topological groups and flagging cycles so you can plan changes without disguising cyclic dependencies.

Instructions

The safe change order of the graph: topological order of the SCC-condensed CODE_SCHEMA section 9 dependency DAG (Kahn's algorithm over Tarjan components). Groups are emitted in dependency order - every dependency of a group appears in an earlier group - members sorted by id. A multi-node group is a dependency cycle and is flagged cyclic, never disguised as an order.

Input Schema

NameRequiredDescriptionDefault
db_pathYesPath to the index database.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare this is a read-only, non-destructive, closed-world operation, so the safety profile is covered. The description adds real behavioral detail beyond that: groups are emitted in dependency order with every dependency in an earlier group, members are sorted by id, and multi-node groups are cycles flagged 'cyclic' rather than disguised as an order - unusually honest output semantics.

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 dense sentences, front-loaded with the outcome ('safe change order') before the algorithm details. Terminology is heavy (SCC, Kahn, Tarjan, CODE_SCHEMA section 9) but each clause contributes distinct information, so little is wasted.

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

Completeness4/5

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

With one fully documented parameter and no output schema, the description compensates well by describing the shape of the result (ordered groups, id-sorted members, cyclic flagging). What remains thin is the per-group payload structure and any guarantee about completeness of the emitted graph.

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 coverage is 100% and the single required parameter db_path is fully documented in the schema, so the baseline of 3 applies. The description adds no extra meaning about what the database path must contain or what happens if the index is stale or missing.

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 precise verb+resource: emits the topological order of the SCC-condensed dependency DAG, computed via Kahn's algorithm over Tarjan components. That is far more specific than siblings like codetopo_blast_radius or codetopo_ancestors, though it never explicitly contrasts itself with them, keeping it just short of a 5.

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 framing 'safe change order' implies when to use it (sequencing changes across dependencies), but the description never says when to prefer it over codetopo_blast_radius, codetopo_ancestors, or codetopo_path, nor does it state prerequisites such as needing a completed index.

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