listAudioVoices
Retrieve available audio voices for text-to-speech generation in the Pollinations Multimodal MCP Server.
Instructions
List available audio voices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/services/audioService.js:216-257 (handler)The handler function that implements the listAudioVoices tool. It fetches the list of available audio voices from the Pollinations API (models endpoint), extracts voices from the openai-audio model, falls back to defaults if needed, and returns them in MCP response format.async function listAudioVoices(params) { try { const url = buildUrl(AUDIO_API_BASE_URL, "models"); const response = await fetch(url); if (!response.ok) { throw new Error(`Failed to list models: ${response.statusText}`); } const models = await response.json(); // Find the openai-audio model and extract its voices const audioModel = models.find( (model) => model.name === "openai-audio", ); let voices; if (audioModel && Array.isArray(audioModel.voices)) { voices = audioModel.voices; } else { // Default voices if we can't find the list voices = ["alloy", "echo", "fable", "onyx", "nova", "shimmer"]; } // Return the response in MCP format using utility functions return createMCPResponse([createTextContent(voices, true)]); } catch (error) { console.error("Error listing audio voices:", error); // Return default voices if there's an error const defaultVoices = [ "alloy", "echo", "fable", "onyx", "nova", "shimmer", ]; // Return the response in MCP format using utility functions return createMCPResponse([createTextContent(defaultVoices, true)]); } }
- src/services/audioService.js:381-381 (registration)The registration entry for the listAudioVoices tool in the audioTools array exported from audioService.js. This array is later spread into the main toolDefinitions in index.js and registered with the MCP server.["listAudioVoices", "List available audio voices", {}, listAudioVoices],
- src/index.js:30-30 (registration)Spreading of audioTools (which includes listAudioVoices registration) into the main toolDefinitions array used for MCP server tool registration....audioTools,
- src/index.js:87-87 (registration)Dynamic registration of all tools, including listAudioVoices, by iterating over toolDefinitions and calling server.tool(...tool) for each.toolDefinitions.forEach((tool) => server.tool(...tool));