Skip to main content
Glama

topo_count

Read-onlyIdempotent

Count distinct topological orderings of a directed acyclic graph from node count and [from, to] edge pairs to assess valid dependency orders.

Instructions

Count the number of distinct topological orderings of a DAG.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "num_nodes": "<num_nodes>",
      "edges": "<edges>"
    },
    "name": "topo_count"
  }
}

Input Schema

NameRequiredDescriptionDefault
edgesYesDirected edges as [from, to] pairs
num_nodesYesNumber of nodes (max 20)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint, so the safety profile is fully covered and the description does not contradict it. The description adds no behavioral context of its own, however - it says nothing about output magnitude (counts grow factorially, which is why the 20-node cap exists) or about behavior with cyclic/invalid input.

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 front-loaded sentence with zero filler; the resource and the operation are stated immediately.

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 two-parameter pure-computation tool with no output schema, the description covers the essential purpose, but it never states that the result is a single integer count or what happens for invalid/cyclic graphs. 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?

Schema description coverage is 100%, with both num_nodes and edges documented including the max-20 limit and the [from, to] edge format. The description adds no meaning beyond the schema, so the baseline of 3 is appropriate.

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 names a specific verb ('count') and a specific resource ('distinct topological orderings of a DAG'), so an agent knows exactly what the tool computes. It does not explicitly name the sibling topo_sort or explain how it differs from it (count vs. produce an ordering), which keeps it out of 5 territory.

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 explicit when-to-use or when-not-to-use guidance, and the obvious alternative (topo_sort, which enumerates a single ordering) is never mentioned. The agent must infer the use case from the verb 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