Skip to main content
Glama

refactor_priority

Ranks untested complexity hotspots in a Python repo by combining cyclomatic complexity, line count, callers, and coverage, so you know which function to refactor first.

Instructions

Rank the top N untested complexity hotspots in a Python repo. Combines cyclomatic complexity, line count, caller count, and test coverage into one composite score. Use this to answer 'what should I refactor first?'

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": {
      "repo_path": "<repo_path>"
    },
    "name": "refactor_priority"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
repo_pathYes
min_priorityNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description does real work: it discloses the ranking semantics, the four inputs to the composite score (cyclomatic complexity, line count, caller count, coverage), and the Python-only constraint. It omits whether coverage data must already exist for the repo and says nothing about runtime cost, which matters for a repo-wide analysis.

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?

Three short sentences, front-loaded with the action and scope, then the scoring method, then the use case. No filler or repetition.

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?

The output schema and the scoring sentence cover results adequately, and the goal is clear. The notable gap is min_priority, a threshold parameter whose semantics are unavailable anywhere, and the unspecified prerequisite that coverage data exist for the "untested" filter to mean anything.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter meaning. It implicitly covers repo_path (Python repo) and limit ("top N"), but min_priority (default 50) is never explained — its scale, units, and effect on the result set are completely undefined.

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?

"Rank the top N untested complexity hotspots in a Python repo" gives a specific verb (rank), a precise resource (untested complexity hotspots), and a scope (Python). The composite-score sentence further separates it from a plain complexity finder, though no sibling is named explicitly, so differentiation still requires some inference.

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

Usage Guidelines4/5

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

"Use this to answer 'what should I refactor first?'" gives a clear situational trigger that an agent can match against a user question. It stops short of stating when NOT to use it or naming an alternative tool for sub-cases (e.g., raw complexity or coverage listings).

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