Skip to main content
Glama

get_refactor_candidates

Read-onlyIdempotent

Find functions with high cyclomatic complexity called from many files, candidates for shared module extraction during architecture review.

Instructions

Find functions with high complexity called from many files — candidates for extraction to shared modules. Use during architecture review to identify hotspots worth refactoring. Read-only. Returns JSON: [{ symbol_id, name, file, cyclomatic, callerCount }]. Set output_format: "toon" for lossless TOON encoding — cheaper LLM tokens on tabular payloads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
min_cyclomaticNoMin cyclomatic complexity (default: 5)
min_callersNoMin distinct caller files (default: 2)
limitNoMax results (default: 20)
output_formatNoOutput format. "json" (default) returns JSON, "markdown" returns LLM-friendly fenced markdown (tool-specific), "toon" returns Token-Oriented Object Notation — 30-60% fewer tokens on tabular data, fully lossless.
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. The description adds 'Read-only' and explains the return format and the TOON encoding benefit, which provides behavioral context beyond the annotations. No contradictions.

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 concise with 4 sentences, front-loaded with the tool's core purpose and usage context. Every sentence adds value, no redundancy. Efficient and well-structured.

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?

Given the tool's simplicity, full schema coverage, and clear annotations, the description covers all necessary aspects: purpose, usage timing, return format, output options. No gaps for an AI agent to invoke it correctly.

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

Parameters4/5

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

Schema description coverage is 100%, with each parameter having a clear description and defaults. The description adds meaning by framing the parameters as filters for 'high complexity' and 'called from many files,' and explains the output_format enum options and the cost benefit of TOON, enhancing the schema.

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 finds functions with high complexity called from many files, specifically for extraction to shared modules. It specifies the use case (architecture review) and the type of output (JSON with fields). This distinguishes it from sibling tools like get_complexity_report or get_coupling.

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?

The description explicitly says 'Use during architecture review to identify hotspots worth refactoring,' providing clear context. It does not mention alternatives or when not to use, but the guidance is sufficiently directive for an AI agent.

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/nikolai-vysotskyi/trace-mcp'

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