mcp__gemini__refactor_suggestions
Receive AI-driven refactoring suggestions to improve code readability, performance, and structure. Input code and specify language and goals for tailored recommendations.
Instructions
Get AI-powered refactoring suggestions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Code to refactor | |
| goals | No | Refactoring goals | readability,performance |
| language | No | Programming language | javascript |
Implementation Reference
- src/tools/code-tools.js:71-90 (handler)The main handler function that implements the tool 'mcp__gemini__refactor_suggestions'. It takes code, language, and goals as input, constructs a detailed prompt for refactoring suggestions, calls the AI client, and returns formatted results.handler: async (args) => { const { code, language = 'javascript', goals = 'readability,performance' } = args; validateString(code, 'code', 20000); const prompt = `Refactor this ${language} code focusing on: ${goals} \`\`\`${language} ${code} \`\`\` Provide: 1. Refactored code with improvements 2. Explanation of changes made 3. Performance impact analysis 4. Maintainability improvements 5. Best practices applied`; const result = await aiClient.call(prompt, 'coding'); return `♻️ **Code Refactoring Suggestions**\n\n${result}`; }
- src/tools/code-tools.js:66-70 (schema)The input schema defining parameters for the tool: code (required), language (default 'javascript'), goals (default 'readability,performance').parameters: { code: { type: 'string', description: 'Code to refactor', required: true }, language: { type: 'string', description: 'Programming language', default: 'javascript' }, goals: { type: 'string', description: 'Refactoring goals', default: 'readability,performance' } },
- src/tools/registry.js:234-240 (registration)Registration of tools from codeTools module (which contains 'mcp__gemini__refactor_suggestions') into the tool registry via registerToolsFromModule.// Register additional tools from modules this.registerToolsFromModule(codeTools); this.registerToolsFromModule(analysisTools); this.registerToolsFromModule(enhancedTools); this.registerToolsFromModule(businessTools); this.registerToolsFromModule(licenseTools);
- src/tools/registry.js:5-6 (registration)Import of the codeTools object containing the tool definition.import { codeTools } from './code-tools.js'; import { analysisTools } from './analysis-tools.js';