Skip to main content
Glama
emmron
by emmron

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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'validation' but doesn't specify what kind of validation, whether it generates code or documentation, what the output format is, or any constraints like rate limits or permissions required. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of generating API endpoints (a code generation task), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects like output format, error handling, or dependencies, which are crucial for effective tool use in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all parameters with descriptions. The description adds no additional meaning beyond what's in the schema, such as explaining how parameters interact or providing examples. The baseline score of 3 reflects adequate coverage by the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Generate REST API endpoints with validation', which specifies the action (generate) and the resource (REST API endpoints). It distinguishes itself from sibling tools like 'generate_component' or 'analyze_codebase' by focusing specifically on API generation, though it doesn't explicitly differentiate from all siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites, scenarios where it's appropriate, or comparisons to other tools in the list like 'generate_component' or 'analyze_codebase' that might overlap in functionality.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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