Skip to main content
Glama

respondText

Generate text responses from prompts using configurable models and parameters. Override defaults via user settings.

Instructions

Respond with text to a prompt using the Pollinations Text API. User-configured settings in MCP config will be used as defaults unless specifically overridden.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe text prompt to generate a response for
modelNoModel to use for text generation (default: user config or "openai"). Use listTextModels to see all available models
seedNoSeed for reproducible results (default: random)
temperatureNoControls randomness in the output (0.0 to 2.0, default: user config or model default)
top_pNoControls diversity via nucleus sampling (0.0 to 1.0, default: user config or model default)
systemNoSystem prompt to guide the model's behavior (default: user config or none)

Implementation Reference

  • The actual implementation of the respondText tool. Makes an HTTP request to the Pollinations Text API with prompt, model, seed, temperature, top_p, system, and authConfig parameters. Always adds 'private=true'. Returns the generated text response.
    export async function respondText(prompt, model = "openai", seed = Math.floor(Math.random() * 1000000), temperature = null, top_p = null, system = null, authConfig = null) {
      if (!prompt || typeof prompt !== 'string') {
        throw new Error('Prompt is required and must be a string');
      }
    
      // Build the query parameters
      const queryParams = new URLSearchParams();
      if (model) queryParams.append('model', model);
      if (seed !== undefined) queryParams.append('seed', seed);
      if (temperature !== null) queryParams.append('temperature', temperature);
      if (top_p !== null) queryParams.append('top_p', top_p);
      if (system) queryParams.append('system', system);
    
      // Always set private to true
      queryParams.append('private', 'true');
    
      // Construct the URL
      const encodedPrompt = encodeURIComponent(prompt);
      const baseUrl = 'https://text.pollinations.ai';
      let url = `${baseUrl}/${encodedPrompt}`;
    
      // Add query parameters if they exist
      const queryString = queryParams.toString();
      if (queryString) {
        url += `?${queryString}`;
      }
    
      try {
        // Prepare fetch options with optional auth headers
        const fetchOptions = {};
        if (authConfig) {
          fetchOptions.headers = {};
          if (authConfig.token) {
            fetchOptions.headers['Authorization'] = `Bearer ${authConfig.token}`;
          }
          if (authConfig.referrer) {
            fetchOptions.headers['Referer'] = authConfig.referrer;
          }
        }
    
        // Fetch the text from the URL
        const response = await fetch(url, fetchOptions);
    
        if (!response.ok) {
          throw new Error(`Failed to generate text: ${response.statusText}`);
        }
    
        // Get the text response
        const textResponse = await response.text();
    
        return textResponse;
      } catch (error) {
        log('Error generating text:', error);
        throw error;
      }
    }
  • MCP server handler that extracts arguments (with defaults from config or env vars), calls respondText(), and returns the result as text content.
    } else if (name === 'respondText') {
      try {
        const { prompt, model = defaultConfig.text.model, seed, temperature = defaultConfig.text.temperature ? Number(defaultConfig.text.temperature) : undefined, top_p = defaultConfig.text.top_p ? Number(defaultConfig.text.top_p) : undefined, system = defaultConfig.text.system } = args;
        const result = await respondText(prompt, model, seed, temperature, top_p, system, finalAuthConfig);
        return {
          content: [
            { type: 'text', text: result }
          ]
        };
      } catch (error) {
        return {
          content: [
            { type: 'text', text: `Error generating text response: ${error.message}` }
          ],
          isError: true
        };
      }
  • JSON Schema definition for the respondText tool, defining input properties: prompt (required string), model, seed, temperature, top_p, and system.
    export const respondTextSchema = {
      name: 'respondText',
      description: 'Respond with text to a prompt using the Pollinations Text API. User-configured settings in MCP config will be used as defaults unless specifically overridden.',
      inputSchema: {
        type: 'object',
        properties: {
          prompt: {
            type: 'string',
            description: 'The text prompt to generate a response for'
          },
          model: {
            type: 'string',
            description: 'Model to use for text generation (default: user config or "openai"). Use listTextModels to see all available models'
          },
          seed: {
            type: 'number',
            description: 'Seed for reproducible results (default: random)'
          },
          temperature: {
            type: 'number',
            description: 'Controls randomness in the output (0.0 to 2.0, default: user config or model default)'
          },
          top_p: {
            type: 'number',
            description: 'Controls diversity via nucleus sampling (0.0 to 1.0, default: user config or model default)'
          },
          system: {
            type: 'string',
            description: 'System prompt to guide the model\'s behavior (default: user config or none)'
          }
        },
        required: ['prompt']
      }
    };
  • src/schemas.js:32-44 (registration)
    Central registration of respondTextSchema in the getAllToolSchemas() array, enabling the MCP server to advertise the tool.
    export function getAllToolSchemas() {
      return [
        generateImageUrlSchema,
        generateImageSchema,
        editImageSchema,
        generateImageFromReferenceSchema,
        listImageModelsSchema,
        respondAudioSchema,
        listAudioVoicesSchema,
        respondTextSchema,
        listTextModelsSchema
      ];
    }
  • Re-exports respondText from textService.js as part of the public API.
      // Text services
      respondText,
      listTextModels,
    };
Behavior3/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. It discloses the API name and default behavior but lacks details on response format, error handling, or rate limits. Minimal transparency beyond basic function.

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?

Two sentences efficiently convey the core function and default behavior. No unnecessary words, and the key action is front-loaded.

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

Completeness4/5

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

For a text generation tool with 6 params, the description covers defaults and model selection. However, without an output schema, it would benefit from describing the response format (e.g., returns text string). Still, it provides necessary context for invocation.

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

Parameters4/5

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

The schema covers all 6 parameters (100% coverage). The description adds value by noting that defaults come from user config or model defaults, and suggests using listTextModels for available models, which goes beyond the schema.

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

Purpose5/5

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

The description clearly states the tool generates text responses via the Pollinations Text API using a prompt. It distinguishes from sibling tools like generateImage and respondAudio.

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

Usage Guidelines4/5

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

The description mentions default settings from user config can be overridden, providing clear usage context. However, it does not explicitly state when not to use this tool or recommend alternatives beyond listing sibling names.

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/pinkpixel-dev/MCPollinations'

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