refactor
Analyze code or a file path with a refactoring checklist to produce a structured refactoring plan JSON that improves readability, reduces complexity, or boosts performance.
Instructions
当用户需要重构代码、改善代码结构时使用。指南型工具:注入 code/file_path 与重构清单,由 Agent 分析后输出重构计划 JSON;MCP 不自动修改源文件
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "refactor"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | 要重构的代码 | |
| goal | No | 重构目标:improve_readability(可读性)、reduce_complexity(复杂度)、performance(性能)。可选 | |
| file_path | No | 要重构的文件路径(相对 project_root 或绝对路径)。未传 code 时从磁盘读取 | |
| project_root | No | 项目根目录绝对路径。配合 file_path 解析相对路径 |