mcp__gemini__code_analyze
Analyze code for quality and issues by specifying the programming language and analysis type. Improve code structure and identify potential problems with this AI-driven tool.
Instructions
Analyze code for quality and issues
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysis_type | No | Type of analysis | comprehensive |
| code | Yes | Code to analyze | |
| language | No | Programming language |
Implementation Reference
- src/tools/registry.js:85-104 (handler)The handler function that implements the core logic of the 'mcp__gemini__code_analyze' tool. It destructures arguments, validates input, constructs an analysis prompt, calls the AI client for code review, and formats the response.async (args) => { const { code, language = 'javascript', analysis_type = 'comprehensive' } = args; validateString(code, 'code', 10000); const prompt = `Analyze this ${language} code for ${analysis_type} review: \`\`\`${language} ${code} \`\`\` Provide: 1. Code quality assessment 2. Security vulnerabilities 3. Performance issues 4. Best practice violations 5. Specific improvement suggestions`; const analysis = await aiClient.call(prompt, 'analysis'); return `📊 **Code Analysis** (${analysis_type})\\n\\n${analysis}`; }
- src/tools/registry.js:77-105 (registration)The registration of the 'mcp__gemini__code_analyze' tool in the ToolRegistry class, specifying name, description, input parameters, and the handler function.this.registerTool( 'mcp__gemini__code_analyze', 'Analyze code for quality and issues', { code: { type: 'string', description: 'Code to analyze', required: true }, language: { type: 'string', description: 'Programming language' }, analysis_type: { type: 'string', description: 'Type of analysis', default: 'comprehensive' } }, async (args) => { const { code, language = 'javascript', analysis_type = 'comprehensive' } = args; validateString(code, 'code', 10000); const prompt = `Analyze this ${language} code for ${analysis_type} review: \`\`\`${language} ${code} \`\`\` Provide: 1. Code quality assessment 2. Security vulnerabilities 3. Performance issues 4. Best practice violations 5. Specific improvement suggestions`; const analysis = await aiClient.call(prompt, 'analysis'); return `📊 **Code Analysis** (${analysis_type})\\n\\n${analysis}`; } );
- src/tools/registry.js:80-83 (schema)The input parameters object used to generate the JSON schema for the tool's arguments: code (required string), language (string), analysis_type (string with default).{ code: { type: 'string', description: 'Code to analyze', required: true }, language: { type: 'string', description: 'Programming language' }, analysis_type: { type: 'string', description: 'Type of analysis', default: 'comprehensive' }