Skip to main content
Glama

topos_compare_files

Read-onlyIdempotent

Compute the AST (tree-edit) distance between two source files on disk. Read-only; parses both files, never writes or scores.

Instructions

Compute the AST (tree-edit) distance between two source files on disk. Read-only; parses both files, never writes or scores. Both files are parsed in the language their suffix names, the same way topos compare does; an unsupported suffix or two different languages is an error. Use for clone detection or refactor impact; use topos_assess_* for a quality verdict. Returns a ComparisonResult (see topos_compare_code).

Input Schema

NameRequiredDescriptionDefault
sourceYesBaseline file path (prefer absolute).
targetYesComparison file path (prefer absolute).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.11.0
    • changedInput schema / properties / source / description
      Previous value: -"Baseline file path."New value: +"Baseline file path (prefer absolute)."
    • changedInput schema / properties / target / description
      Previous value: -"Comparison file path."New value: +"Comparison file path (prefer absolute)."
  2. Changed5 schema fields changedv0.4.0
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / properties / params
      Removed value: -{
      -  "additionalProperties": false,
      -  "description": "Arguments for ``topos_compare_files``.",
      -  "properties": {
      -    "source": {
      -      "description": "Baseline file path.",
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "target": {
      -      "description": "Comparison file path.",
      -      "minLength": 1,
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "source",
      -    "target"
      -  ],
      -  "type": "object"
      -}
    • addedInput schema / properties / source
      Added value: +{
      +  "description": "Baseline file path.",
      +  "type": "string"
      +}
    • addedInput schema / properties / target
      Added value: +{
      +  "description": "Comparison file path.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "params"
      -]New value: +[
      +  "source",
      +  "target"
      +]
  3. First observedv0.3.6

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), and the description adds meaningful behavior beyond them: both files are parsed in the language their suffix names, the same way `topos compare` does, and mismatched languages or unsupported suffixes are errors. It also states it never writes or scores, which is non-obvious for a comparison tool.

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?

Front-loaded with the core operation, then usage, then return type. Slightly dense with the parenthetical and cross-references, but nearly every clause adds routing or behavioral information rather than filler.

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?

For a two-param read-only tool with no output schema, the description covers operation, language inference, error conditions, and usage routing. The one gap is that the return shape is delegated entirely to `topos_compare_code` rather than described, which is acceptable but requires a cross-reference.

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%, so both parameters are documented in the schema as baseline/target paths. The description adds only the behavioral note that language is inferred from the file suffix, which is useful but not parameter-specific; baseline 3 is appropriate when the schema carries the load.

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 verb and resource: 'Compute the AST (tree-edit) distance between two source files on disk.' It goes further by naming the sibling it is not (topos_assess_* for quality verdict) and the related return type (topos_compare_code), so an agent can distinguish it without opening schemas.

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?

Explicitly names use cases ('clone detection or refactor impact') and the alternative with its own domain ('use topos_assess_* for a quality verdict'). It also states error conditions (unsupported suffix, two different languages) that constrain when the tool will succeed.

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