Skip to main content
Glama
tusharpatil2912

Pollinations Multimodal MCP Server

generateText

Generate text responses from prompts using AI models, with options for reproducible results, system behavior settings, and output formats.

Instructions

Generate text from a prompt using the Pollinations Text API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesThe text prompt to generate a response for
modelNoModel to use for text generation (default: "openai")
optionsNoAdditional options for text generation

Implementation Reference

  • The handler function that implements the generateText tool logic, fetching generated text from the Pollinations Text API based on the provided prompt and options.
    async function generateText(params) {
        const { prompt, model = "openai", options = {} } = params;
    
        if (!prompt || typeof prompt !== "string") {
            throw new Error("Prompt is required and must be a string");
        }
    
        const { seed, systemPrompt, json, isPrivate } = options;
    
        // Prepare query parameters
        const queryParams = {
            model,
            seed,
            ...(systemPrompt && { system: encodeURIComponent(systemPrompt) }),
            ...(json && { json: "true" }),
            ...(isPrivate && { private: "true" }),
        };
    
        // Construct the URL
        const encodedPrompt = encodeURIComponent(prompt);
        const url = buildUrl(TEXT_API_BASE_URL, encodedPrompt, queryParams);
    
        try {
            // Fetch the text from the URL
            const response = await fetch(url);
    
            if (!response.ok) {
                throw new Error(`Failed to generate text: ${response.statusText}`);
            }
    
            // Get the text response
            const textResponse = await response.text();
    
            // Return the response in MCP format
            return createMCPResponse([createTextContent(textResponse)]);
        } catch (error) {
            console.error("Error generating text:", error);
            throw error;
        }
    }
  • Zod schema defining the input parameters for the generateText tool, including prompt, model, and options.
    prompt: z
        .string()
        .describe("The text prompt to generate a response for"),
    model: z
        .string()
        .optional()
        .describe(
            'Model to use for text generation (default: "openai")',
        ),
    options: z
        .object({
            seed: z
                .number()
                .optional()
                .describe("Seed for reproducible results"),
            systemPrompt: z
                .string()
                .optional()
                .describe(
                    "Optional system prompt to set the behavior of the AI",
                ),
            json: z
                .boolean()
                .optional()
                .describe(
                    "Set to true to receive response in JSON format",
                ),
            isPrivate: z
                .boolean()
                .optional()
                .describe(
                    "Set to true to prevent the response from appearing in the public feed",
                ),
        })
        .optional()
        .describe("Additional options for text generation"),
  • The registration entry for the generateText tool in the textTools array, including name, description, schema, and handler reference. This array is spread into toolDefinitions and registered via server.tool() in src/index.js.
    [
        "generateText",
        "Generate text from a prompt using the Pollinations Text API",
        {
            prompt: z
                .string()
                .describe("The text prompt to generate a response for"),
            model: z
                .string()
                .optional()
                .describe(
                    'Model to use for text generation (default: "openai")',
                ),
            options: z
                .object({
                    seed: z
                        .number()
                        .optional()
                        .describe("Seed for reproducible results"),
                    systemPrompt: z
                        .string()
                        .optional()
                        .describe(
                            "Optional system prompt to set the behavior of the AI",
                        ),
                    json: z
                        .boolean()
                        .optional()
                        .describe(
                            "Set to true to receive response in JSON format",
                        ),
                    isPrivate: z
                        .boolean()
                        .optional()
                        .describe(
                            "Set to true to prevent the response from appearing in the public feed",
                        ),
                })
                .optional()
                .describe("Additional options for text generation"),
        },
        generateText,
    ],
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. It mentions the API but doesn't describe key traits like rate limits, authentication needs, cost implications, or what happens when generation fails. 'Generate text' implies a write-like operation, but without annotations, it's unclear if this is idempotent, reversible, or has side effects.

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 states the core purpose without waste. It's appropriately sized and front-loaded, with every word contributing to understanding the tool's 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?

Given the complexity (3 parameters with nested objects) and lack of annotations and output schema, the description is insufficient. It doesn't explain return values, error handling, or behavioral nuances, leaving significant gaps for a generative AI tool that likely has important operational constraints.

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 fully documents all parameters. The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions, default behaviors beyond the schema's 'default: "openai"', or practical 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 action ('Generate text') and the resource ('from a prompt using the Pollinations Text API'), providing a specific verb+resource combination. However, it doesn't distinguish this text generation tool from sibling tools like 'generateImage' or 'respondAudio' beyond mentioning the API name, missing explicit differentiation about when to use text vs. audio/image generation.

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 like 'respondAudio' or 'generateImage'. There's no mention of specific use cases, prerequisites, or exclusions, leaving the agent with minimal context for tool selection among siblings.

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/tusharpatil2912/pollinations-mcp'

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