Skip to main content
Glama

find_refactoring_opportunities

Detect dead code and god objects to identify refactoring targets. Scans a project for zero-incoming-edge code and overly complex classes.

Instructions

Find code health anomalies: dead code (0 incoming edges) and god objects.

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": {
      "projectName": "<projectName>"
    },
    "name": "find_refactoring_opportunities"
  }
}

Input Schema

NameRequiredDescriptionDefault
metricTypeNoAnomaly type: 'dead_code', 'god_objects', 'all'. Default: 'all'.all
projectNameYesTarget project name.
workspacePathNoOptional workspace root path.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.80.5

TDQS

B3.3/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full behavioral burden. It does add one genuinely useful definition ('dead code = 0 incoming edges'), and 'Find' implies a read-only analysis, but it says nothing about result format, granularity, size limits, or whether a prior scan/ingest is required.

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?

A single front-loaded sentence with zero filler; the detected anomaly types are stated immediately with a clarifying definition in parentheses.

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?

With no output schema, the description should tell the agent what comes back — shapes of anomaly records, whether locations/severities are included. It also omits any prerequisite context about workspace indexing, leaving the definition adequate but incomplete for a project-wide analysis tool.

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 three parameters are already documented, including the metricType enum values. The description's mention of dead code and god objects loosely mirrors the metricType options but adds no syntax, scoping, or default behavior beyond the schema, so the baseline 3 applies.

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?

States a specific verb ('Find') and resource ('code health anomalies') and enumerates the two anomaly classes it detects, including a parenthetical definition of dead code ('0 incoming edges'). That makes it distinguishable from structural query siblings like find_symbol or get_call_chain, though it never names an alternative explicitly.

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

Usage Guidelines2/5

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

There is no when-to-use guidance: no statement of the scenario this tool serves, no prerequisites (e.g. that the workspace/project must be indexed first), and no exclusion pointing to another tool for related health checks. The only usage signal is implicit in the anomaly types named.

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