Skip to main content
Glama

respondText

Generate text responses to prompts using AI models through the Pollinations Text API. Configure settings like model selection, temperature, and system prompts for customized output.

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

  • Core handler function implementing the respondText tool by fetching generated text from Pollinations text API with configurable parameters.
    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;
      }
    }
  • Input schema and metadata definition for the respondText tool used in MCP tool registration.
    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']
      }
    };
  • MCP server request handler for ListToolsRequestSchema that returns all tool schemas including respondText via getAllToolSchemas().
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: getAllToolSchemas()
    }));
  • Dispatch logic in MCP server's CallToolRequestSchema handler that routes respondText calls to the tool implementation with defaults.
    } 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
        };
      }
  • src/schemas.js:32-44 (registration)
    Central function that aggregates and returns all tool schemas for registration, including respondTextSchema.
    export function getAllToolSchemas() {
      return [
        generateImageUrlSchema,
        generateImageSchema,
        editImageSchema,
        generateImageFromReferenceSchema,
        listImageModelsSchema,
        respondAudioSchema,
        listAudioVoicesSchema,
        respondTextSchema,
        listTextModelsSchema
      ];
    }
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 default settings from MCP config, which adds some context, but lacks details on rate limits, authentication needs, error handling, or output format. For a text generation tool with no annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is concise and front-loaded with the core purpose in the first sentence. The second sentence adds useful context about defaults without unnecessary elaboration. Both sentences earn their place, making it efficient and well-structured.

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

Completeness3/5

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

Given the tool's complexity (6 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and default behavior, but lacks details on output format, error cases, or advanced usage scenarios. Without annotations or output schema, more context would be beneficial for a generative AI tool.

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 schema already documents all parameters thoroughly. The description adds minimal value beyond the schema by hinting at defaults ('user-configured settings... as defaults'), but doesn't provide additional semantics or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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: 'Respond with text to a prompt using the Pollinations Text API.' It specifies the verb ('respond'), resource ('text'), and API context. However, it doesn't explicitly differentiate from sibling tools like 'respondAudio' or 'listTextModels' beyond mentioning 'text' versus 'audio'.

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

Usage Guidelines3/5

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

The description provides some usage context by mentioning 'User-configured settings in MCP config will be used as defaults unless specifically overridden,' which implies when to override defaults. However, it doesn't explicitly state when to use this tool versus alternatives like 'listTextModels' (for model selection) or 'respondAudio' (for audio responses), leaving usage somewhat implied rather than clearly defined.

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