Skip to main content
Glama

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
NameRequiredDescriptionDefault
databaseNoDatabase typemongodb
frameworkNoBackend frameworkexpress
methodsNoHTTP methodsGET,POST,PUT,DELETE
resourceYesResource name

Implementation Reference

  • 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}`; }
  • 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' } },
  • 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); }); }
  • Specific call that registers all tools from codeTools, including the target tool.
    this.registerToolsFromModule(codeTools);

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