Skip to main content
Glama

ask_gemini

Query Google Gemini AI models through the MCP AI Bridge to generate responses for prompts with configurable parameters.

Instructions

Ask Google Gemini AI a question

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe prompt to send to Gemini
modelNoThe model to use (default: gemini-1.5-flash-latest)gemini-1.5-flash-latest
temperatureNoTemperature for response generation (0-1)

Implementation Reference

  • src/index.js:119-147 (registration)
    Registration of the 'ask_gemini' tool including its name, description, and input schema in the getAvailableTools() method.
    if (this.gemini) {
      tools.push({
        name: 'ask_gemini',
        description: 'Ask Google Gemini AI a question',
        inputSchema: {
          type: 'object',
          properties: {
            prompt: {
              type: 'string',
              description: 'The prompt to send to Gemini',
            },
            model: {
              type: 'string',
              description: `The model to use (default: ${DEFAULTS.GEMINI.MODEL})`,
              enum: MODELS.GEMINI,
              default: DEFAULTS.GEMINI.MODEL,
            },
            temperature: {
              type: 'number',
              description: `Temperature for response generation (${DEFAULTS.GEMINI.MIN_TEMPERATURE}-${DEFAULTS.GEMINI.MAX_TEMPERATURE})`,
              default: DEFAULTS.GEMINI.TEMPERATURE,
              minimum: DEFAULTS.GEMINI.MIN_TEMPERATURE,
              maximum: DEFAULTS.GEMINI.MAX_TEMPERATURE,
            },
          },
          required: ['prompt'],
        },
      });
    }
  • The handler function that implements the core logic for the 'ask_gemini' tool: validates inputs, calls the Gemini API, formats the response, and handles errors.
    async handleGemini(args) {
      if (!this.gemini) {
        throw new ConfigurationError(ERROR_MESSAGES.GEMINI_NOT_CONFIGURED);
      }
    
      // Validate inputs
      const prompt = validatePrompt(args.prompt);
      const model = validateModel(args.model, 'GEMINI');
      const temperature = validateTemperature(args.temperature, 'GEMINI');
    
      try {
        if (process.env.NODE_ENV !== 'test') logger.debug(`Gemini request - model: ${model}, temperature: ${temperature}`);
        
        const geminiModel = this.gemini.getGenerativeModel({ 
          model: model,
          generationConfig: {
            temperature: temperature,
          },
        });
        
        const result = await geminiModel.generateContent(prompt);
        const response = await result.response;
        const text = response.text();
    
        return {
          content: [
            {
              type: 'text',
              text: `🤖 GEMINI RESPONSE (${model}):\n\n${text}`,
            },
          ],
        };
      } catch (error) {
        if (error.message?.includes('quota')) {
          throw new APIError('Gemini quota exceeded. Please try again later.', 'Gemini');
        } else if (error.message?.includes('API key')) {
          throw new ConfigurationError('Invalid Gemini API key');
        } else {
          throw new APIError(`Gemini API error: ${error.message}`, 'Gemini');
        }
      }
    }
  • Dispatch case in the main request handler that routes 'ask_gemini' calls to the handleGemini method.
    case 'ask_gemini':
      return await this.handleGemini(args);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Ask Google Gemini AI a question' implies a read-only query operation, but provides no information about rate limits, authentication requirements, response formats, error handling, or any behavioral characteristics. The description is minimal and lacks essential operational context.

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 extremely concise at just 5 words, front-loading the essential information with zero wasted words. It efficiently communicates the core purpose without unnecessary elaboration. Every word earns its place in this minimal but complete statement of function.

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?

For a tool with 3 parameters, no annotations, and no output schema, the description is insufficiently complete. While concise, it lacks critical context about behavioral characteristics, output format, error conditions, and differentiation from sibling tools. The agent would need to rely heavily on schema information alone, which is inadequate for proper tool selection and invocation.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 action ('Ask') and target resource ('Google Gemini AI'), making the purpose immediately understandable. It distinguishes from 'ask_openai' by specifying the AI provider, though it doesn't explicitly mention the sibling differentiation. The description is specific enough to understand what the tool does without being tautological.

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 the 'ask_openai' sibling tool. There's no mention of differences in capabilities, cost, performance, or appropriate use cases between Gemini and OpenAI. The agent receives no help in choosing between these two similar tools beyond the provider name.

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

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/fakoli/mcp-ai-bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server