Skip to main content
Glama

generate_refactoring_code

Generates refactored code and a unified diff for a refactoring plan, using an LLM to produce the actual code changes and a git-style diff.

Instructions

Generate refactored code + a unified diff for one refactoring plan.

Opt-in code generation: turns a deterministic plan (from
``get_health(include=["refactoring"])`` — use a plan's ``id``) into the
actual named code and a git-style diff, grounded on the plan plus the real
source spans it references. For Extract Class the result carries an LCOM4
before/after self-check.

Disabled by default — returns an ``error`` unless ``refactoring.llm.enabled``
is set in the repo's ``.repowise/config.yaml``. Uses the repo's configured
provider/model (BYO key) and caches by a content hash, so an unchanged plan
never regenerates.

Args:
    suggestion_id: The ``id`` of a plan from ``get_health(... "refactoring")``.
    repo: Repo alias / id / path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoNo
suggestion_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description fully covers behavioral traits: it is disabled by default, uses a configured LLM provider, caches results by content hash, and performs a LCOM4 self-check for Extract Class.

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?

The description is well-structured but slightly verbose; it effectively uses paragraphs for prerequisites and args, but a few sentences could be trimmed without losing clarity.

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 existence of an output schema, the description covers all necessary context: prerequisites, parameter semantics, behavioral notes, and caching behavior, making it complete for a code generation tool.

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

Parameters5/5

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

Schema coverage is 0%, but the description compensates by explaining both parameters: suggestion_id as the plan ID from get_health, and repo as repository alias/id/path.

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 generates refactored code and a unified diff from a refactoring plan, which distinguishes it from sibling tools like get_health (which provides plans) and other analysis tools.

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 explicitly explains that the tool is opt-in and disabled by default, requires a specific config flag, and instructs the user to obtain a plan ID from get_health with include=['refactoring'].

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/repowise-dev/repowise'

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