Skip to main content
Glama

topo_sort

Sorts directed graph edges into topological order and detects cycles, helping you validate dependencies or resolve task sequences before processing.

Instructions

Topological sort of a directed graph with cycle detection.

Input Schema

NameRequiredDescriptionDefault
edgesYesArray of [from, to] directed edge pairs.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

A3.5/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 burden. It does not state what the tool returns (order list, cycle indicator, boolean), whether the graph is weighted, whether parallel edges are handled, or error behavior on cycles. Only the existence of cycle detection is disclosed – significant behavioral gaps remain for a mutation-free algorithmic tool.

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?

One efficient sentence that front-loads the operation, resource, and distinguishing feature. No wasted words.

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?

With no annotations and no output schema, the description needs to carry more detail than it does. It omits return format, cycle-handling behavior, and edge case semantics, making it only minimally adequate for correct invocation.

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 'edges' parameter is documented as 'Array of [from, to] directed edge pairs.' The description adds no syntax or format details beyond the schema, so baseline 3 is appropriate.

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?

States a specific algorithmic verb+resource ('Topological sort of a directed graph') and adds the distinguishing feature ('with cycle detection'), which sets it apart from the many other graph sibling tools like bfs_search, dfs_search, and topo_count.

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 usage for directed graphs by naming the resource, but provides no explicit when-to-use or when-not-to-use guidance relative to alternatives like bfs_search or dfs_search. For an algorithmic tool in a dense sibling cluster, this is implied but not stated.

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