Skip to main content
Glama

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
NameRequiredDescriptionDefault
codeYesCode to refactor
goalsNoRefactoring goalsreadability,performance
languageNoProgramming languagejavascript

Implementation Reference

  • 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}`; }
  • 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' } },
  • 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);
  • Import of the codeTools object containing the tool definition.
    import { codeTools } from './code-tools.js'; import { analysisTools } from './analysis-tools.js';

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/emmron/gemini-mcp'

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