listTextModels
Retrieve a list of available text models from Pollinations to select the best one for your text generation tasks.
Instructions
List available text models
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/services/textService.js:80-99 (handler)The core handler function for listTextModels. It fetches available text models from the Pollinations API endpoint https://text.pollinations.ai/models and returns them as an object with a 'models' property.
/** * List available text generation models from Pollinations API * * @returns {Promise<Object>} - Object containing the list of available text models */ export async function listTextModels() { try { const response = await fetch('https://text.pollinations.ai/models'); if (!response.ok) { throw new Error(`Failed to list text models: ${response.statusText}`); } const models = await response.json(); return { models }; } catch (error) { log('Error listing text models:', error); throw error; } } - src/services/textSchema.js:43-53 (schema)The schema definition for the listTextModels tool. It defines the tool name as 'listTextModels', provides a description 'List available text models', and specifies an empty input schema (no parameters required).
/** * Schema for the listTextModels tool */ export const listTextModelsSchema = { name: 'listTextModels', description: 'List available text models', inputSchema: { type: 'object', properties: {} } }; - pollinations-mcp-server.js:313-328 (registration)The MCP server handler that routes the 'listTextModels' tool call. When the tool name matches, it calls the listTextModels() function and returns the result as JSON text content, with error handling.
} else if (name === 'listTextModels') { try { const result = await listTextModels(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error listing text models: ${error.message}` } ], isError: true }; } - pollinations-mcp-server.js:98-98 (registration)Import of the listTextModels function from the client library, making it available for use in the MCP server.
listTextModels, - src/index.js:10-28 (registration)Import and re-export of listTextModels from the textService module, serving as the central client library entry point.
import { respondText, listTextModels } from './services/textService.js'; // Export all service functions export { // Image services generateImageUrl, generateImage, editImage, generateImageFromReference, listImageModels, // Audio services respondAudio, listAudioVoices, // Text services respondText, listTextModels,