Skip to main content
Glama

refactor

Read-onlyIdempotent

Generate a JSON refactoring plan to improve code readability, reduce complexity, or optimize performance. Provides analysis without altering source files.

Instructions

当用户需要重构代码、改善代码结构时使用。指南型工具:注入 code/file_path 与重构清单,由 Agent 分析后输出重构计划 JSON;MCP 不自动修改源文件

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo要重构的代码
goalNo重构目标:improve_readability(可读性)、reduce_complexity(复杂度)、performance(性能)。可选
file_pathNo要重构的文件路径(相对 project_root 或绝对路径)。未传 code 时从磁盘读取
project_rootNo项目根目录绝对路径。配合 file_path 解析相对路径
Behavior5/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true. The description adds valuable behavioral context: it is a guidance tool that injects code/file_path, analyzes, and outputs a refactoring plan JSON, and explicitly states that MCP does not modify source files. No contradictions with annotations.

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?

Two sentences with no wasted words. The description is front-loaded with the purpose and immediately clarifies the tool's non-modifying nature and output format.

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 4 parameters (0 required) and no output schema, the description explains the output (refactoring plan JSON) and behavior (no file modification). It lacks details on how conflicting inputs (both code and file_path) are handled, but overall it is sufficient for an agent to understand the tool's capabilities.

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 the schema already documents all four parameters adequately. The description mentions 'injection of code/file_path' but adds no new information beyond what the schema provides. Baseline 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?

Description clearly states the tool is for refactoring code and improving code structure. It specifies it's a guidance tool that outputs a refactoring plan JSON without modifying files, distinguishing it from sibling tools like fix_bug or add_feature.

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?

Description explicitly indicates when to use ('当用户需要重构代码、改善代码结构时使用') and mentions it's a guidance tool with no automatic file modification. It does not explicitly state when not to use, but the context is clear enough for an agent to choose appropriately among siblings.

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/mybolide/mcp-probe-kit'

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