Skip to main content
Glama

Topos Structural Comparison

topos_compare_files
Read-onlyIdempotent

Compute AST distance between two source files to identify clones or assess refactor impact. Returns normalized distance and similarity.

Instructions

Compute the AST (tree-edit) distance between two source files on disk.

Read-only; parses both files, never writes or scores. Use for clone detection or refactor impact; use topos_assess_* for a quality verdict. Returns a ComparisonResult: normalized_distance in [0, 1], similarity (= 1 - it), raw_distance, an operations edit-count map, and source_valid/target_valid (error set on read/parse failure).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYesArguments for ``topos_compare_files``.
Behavior5/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint. The description adds value by confirming 'Read-only; parses both files, never writes or scores' and detailing the return structure (ComparisonResult with fields), which goes beyond annotation hints.

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?

The description is compact (4 sentences) with front-loaded purpose. Every sentence contributes: action, read-only declaration, usage distinction, and return details. No wasted words.

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

Completeness5/5

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

Despite lacking an output schema, the description fully specifies the return type (ComparisonResult) and its fields. It also covers error handling ('source_valid'/'target_valid' with 'error' on failure). Combined with annotations, the agent has all needed information to select and invoke the tool correctly.

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% with clear descriptions for 'source' and 'target' parameters ('Baseline file path.' and 'Comparison file path.'). The description does not add further parameter semantics, so it meets the baseline for high schema coverage but does not enhance beyond it.

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?

The description clearly states the tool's action: 'Compute the AST (tree-edit) distance between two source files on disk.' It uses a specific verb ('Compute') and resource ('AST distance between source files'), and distinguishes from sibling 'topos_assess_*' tools for quality verdicts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use this tool for 'clone detection or refactor impact' and not for quality verdicts, directing the agent to 'topos_assess_*' instead. It also notes the tool is read-only, giving clear when-to-use and when-not-to-use guidance.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Krv-Labs/topos'

If you have feedback or need assistance with the MCP directory API, please join our Discord server