Skip to main content
Glama

generate_text

Generate text content using Google's Gemini 2.5 Pro AI model. Provide a text prompt to create responses, articles, or creative writing with customizable token limits and temperature settings.

Instructions

Generate text using Gemini 2.5 Pro model

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe text prompt to send to Gemini
maxTokensNoMaximum number of tokens to generate (optional)
temperatureNoTemperature for text generation (0.0 to 2.0)

Implementation Reference

  • The main handler function for the generate_text tool. It destructures the prompt and temperature from args, configures generation parameters, calls the Gemini model to generate content, extracts the text response, and returns it in the expected MCP format.
    private async handleTextGeneration(args: any) {
      const { prompt, temperature = 1.0 } = args;
    
      const generationConfig = {
        temperature: Math.max(0, Math.min(2, temperature)),
        maxOutputTokens: args.maxTokens || 1000,
      };
    
      const result = await this.model.generateContent({
        contents: [{ role: "user", parts: [{ text: prompt }] }],
        generationConfig,
      });
    
      const response = result.response;
      const text = response.text();
    
      return {
        content: [
          {
            type: "text",
            text: text,
          },
        ],
      };
    }
  • Defines the input schema for the generate_text tool, including properties for prompt (required), maxTokens, and temperature with descriptions and defaults.
    inputSchema: {
      type: "object",
      properties: {
        prompt: {
          type: "string",
          description: "The text prompt to send to Gemini",
        },
        maxTokens: {
          type: "number",
          description: "Maximum number of tokens to generate (optional)",
          default: 1000,
        },
        temperature: {
          type: "number",
          description: "Temperature for text generation (0.0 to 2.0)",
          default: 1.0,
        },
      },
      required: ["prompt"],
    },
  • src/index.ts:49-72 (registration)
    The tool registration entry returned by listTools, defining the name, description, and input schema for generate_text.
    {
      name: "generate_text",
      description: "Generate text using Gemini 2.5 Pro model",
      inputSchema: {
        type: "object",
        properties: {
          prompt: {
            type: "string",
            description: "The text prompt to send to Gemini",
          },
          maxTokens: {
            type: "number",
            description: "Maximum number of tokens to generate (optional)",
            default: 1000,
          },
          temperature: {
            type: "number",
            description: "Temperature for text generation (0.0 to 2.0)",
            default: 1.0,
          },
        },
        required: ["prompt"],
      },
    },
  • src/index.ts:102-103 (registration)
    Switch case in the CallToolRequest handler that routes generate_text calls to the handleTextGeneration method.
    case "generate_text":
      return await this.handleTextGeneration(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the specific model ('Gemini 2.5 Pro') which is useful context, but fails to disclose critical behavioral traits like rate limits, authentication requirements, cost implications, response format, or error handling. For a text generation tool with zero annotation coverage, this leaves significant gaps.

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 communicates the core functionality without any wasted words. It's appropriately sized for a straightforward tool and front-loads the essential information. Every word earns its place in this concise statement.

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 a text generation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns, how to interpret results, error conditions, or practical limitations. While the schema covers parameters well, the overall context for using this tool effectively is lacking.

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 three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema. The baseline score of 3 reflects adequate parameter documentation through the schema alone, with no value added by 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 ('Generate text') and specifies the resource ('using Gemini 2.5 Pro model'), making the purpose immediately understandable. It distinguishes from the sibling 'analyze_image' by focusing on text generation rather than image analysis. However, it doesn't specify what kind of text generation (e.g., creative, factual, code) which prevents a perfect score.

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 use cases, prerequisites, or comparison with other text generation methods. The agent must infer usage purely from the tool name and parameters without any contextual direction.

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/lutic1/Google-MCP-Server-'

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