Skip to main content
Glama

topos_refactor

Read-onlyIdempotent

Identify refactoring hotspots by analyzing cycle, dependency, process, or graph structure. Returns a ranked list of suggestions to guide code improvements.

Instructions

Rank structural refactor hotspots for one file (read-only, advisory). Does not score the four pillars — use topos_evaluate_* for medals and topos_assess_* to verify edits afterward. target selects the engine: cycles (CFG loop/branch bodies), dependencies (MDG Forman curvature on imports; needs .gitnexus), process (execution choke points; needs .gitnexus), or graphify (orphan/fragile edges; needs a Graphify graph from topos_generate_graphify_graph). Returns a RefactorResult with ranked hotspots (kind, label, score, suggestion, optional lines).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum hotspots to return (default 5).
targetYesWhich analysis engine to run: `cycles` (CFG), `dependencies` / `process` (need `.gitnexus`), or `graphify` (need Graphify graph).
filepathYesSource file path relative to the MCP file root.
gitnexus_dirNoOverride `.gitnexus` directory (`dependencies` / `process` targets).
graphify_dirNoOverride Graphify output directory (`target=graphify` only).
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, so the safe/advisory nature is expected. The description adds valuable context beyond annotations: it discloses engine-specific prerequisites (.gitnexus, Graphify graph), states the return type (RefactorResult with hotspots), and clarifies that it does not score the four pillars. It does not mention error behavior when prerequisites are missing, but that is a minor gap given the coverage.

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 yet comprehensive: a one-sentence core purpose, a one-sentence differentiation, a concise enumeration of target engines with prerequisites, and a brief note on the return type. Every sentence carries information and there is no 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 tool with five parameters, two required, and several engine-specific prerequisites, the description covers the main purpose, alternatives, prerequisites, and return structure. It does not exhaustively document all edge cases (e.g., behavior without .gitnexus) but is sufficiently complete given the complexity and the lack of an output schema.

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 all parameters have detailed descriptions in the schema itself. The tool description restates some parameter guidance (e.g., which targets need .gitnexus) and adds the relationship between gitnexus_dir/graphify_dir and specific targets, but it does not significantly augment the schema. A baseline of 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?

The description clearly states the tool's function with a specific verb and resource: 'Rank structural refactor hotspots for one file'. It explicitly distinguishes itself from siblings by noting it does not score the four pillars and directing the reader to topos_evaluate_* and topos_assess_* for those purposes.

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 provides explicit guidance on when to use this tool versus alternatives: it says to use topos_evaluate_* for medals and topos_assess_* to verify edits. It also mentions prerequisites for specific targets (e.g., dependencies/process need .gitnexus) and names topos_generate_graphify_graph as a prerequisite for graphify.

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