mcp__gemini__generate_api
Automate REST API endpoint creation with validation for resources, supporting HTTP methods, backend frameworks, and database types in your preferred configuration.
Instructions
Generate REST API endpoints with validation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database type | mongodb |
| framework | No | Backend framework | express |
| methods | No | HTTP methods | GET,POST,PUT,DELETE |
| resource | Yes | Resource name |
Implementation Reference
- src/tools/code-tools.js:42-61 (handler)The handler function that constructs a prompt for the AI client to generate REST API endpoints based on the provided resource, methods, framework, and database parameters, then formats and returns the result.handler: async (args) => { const { resource, methods = 'GET,POST,PUT,DELETE', framework = 'express', database = 'mongodb' } = args; validateString(resource, 'resource name'); const prompt = `Generate ${framework} API endpoints for "${resource}" resource. Methods: ${methods} Database: ${database} Include: 1. Route definitions 2. Request validation 3. Error handling 4. Database operations 5. Response formatting 6. Authentication middleware`; const result = await aiClient.call(prompt, 'coding'); return `🔌 **${framework.toUpperCase()} API Generated**\n\n${result}`; }
- src/tools/code-tools.js:35-41 (schema)The input schema defining parameters for the tool: resource (required), methods, framework, and database with types, descriptions, defaults, and requirements.description: 'Generate REST API endpoints with validation', parameters: { resource: { type: 'string', description: 'Resource name', required: true }, methods: { type: 'string', description: 'HTTP methods', default: 'GET,POST,PUT,DELETE' }, framework: { type: 'string', description: 'Backend framework', default: 'express' }, database: { type: 'string', description: 'Database type', default: 'mongodb' } },
- src/tools/registry.js:244-248 (registration)The registerToolsFromModule method iterates over tools in modules like codeTools and registers each using registerTool(name, description, parameters, handler). Called at line 235 with codeTools to register mcp__gemini__generate_api.registerToolsFromModule(toolsModule) { Object.entries(toolsModule).forEach(([name, tool]) => { this.registerTool(name, tool.description, tool.parameters, tool.handler); }); }
- src/tools/registry.js:235-235 (registration)Specific call that registers all tools from codeTools, including the target tool.this.registerToolsFromModule(codeTools);