review_code
Analyzes and evaluates provided code to identify potential issues, improve quality, and ensure alignment with specified focus areas.
Instructions
Reviews the given code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Code to review | |
| focus_areas | No | Areas to focus on |
Implementation Reference
- claude-code-server/src/index.ts:532-548 (handler)Handler for the 'review_code' tool. Extracts arguments, encodes the code to base64, constructs a prompt for code review, calls Claude CLI via runClaudeCommand, and returns the response.case 'review_code': { const { code, focus_areas } = args; try { logger.debug(`Processing review_code request, code length: ${code.length}`); const encodedCode = encodeText(truncateIfNeeded(code)); logger.debug(`Code encoded to base64, length: ${encodedCode.length}`); const prompt = `You are super professional engineer. Please review the following Base64 encoded code. Consider code readability, efficiency, potential bugs, and security vulnerabilities.\n\nCode:\n${encodedCode}\n\nFocus areas (if provided):\n${focus_areas || 'No specific focus areas provided.'}`; logger.debug('Calling Claude CLI with prompt'); const output = await runClaudeCommand(['--print'], prompt); logger.debug(`Received response from Claude, length: ${output.length}`); return { content: [{ type: 'text', text: output }] }; } catch (err) { logger.error("Error in review_code:", err); logger.debug(`review_code error details: ${err instanceof Error ? err.stack : String(err)}`); throw err; } }
- claude-code-server/src/index.ts:335-346 (registration)Registration of the 'review_code' tool in the ListTools response, including name, description, and input schema.{ name: 'review_code', description: 'Reviews the given code.', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Code to review' }, focus_areas: { type: 'string', description: 'Areas to focus on', default: '' } }, required: ['code'] } },
- Input schema definition for the 'review_code' tool, specifying required 'code' parameter and optional 'focus_areas'.inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Code to review' }, focus_areas: { type: 'string', description: 'Areas to focus on', default: '' } }, required: ['code'] } },