list_voices
Discover available text-to-speech voices to select options for speech generation in the Speech MCP Server.
Instructions
List all available voices for text-to-speech
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:309-317 (handler)MCP server request handler for the 'list_voices' tool. Invokes TTSClient.listVoices() and returns formatted list of voices.case "list_voices": { const voices = await ttsClient.listVoices(); return { content: [{ type: "text", text: `Available voices:\n${voices.join('\n')}` }], }; }
- src/index.ts:218-228 (helper)Core logic in TTSClient class that lists and filters high-quality voices from the KokoroTTS instance after ensuring initialization.async listVoices(): Promise<KokoroVoice[]> { await this.waitForInit(); if (!this.ttsInstance) { throw new Error("TTS model not initialized"); } // @ts-ignore-line const allVoices = this.ttsInstance.voices as unknown as {[voice: string]: {overallGrade: string; gender: string}}; const goodVoices = Object.keys(allVoices) .filter((voiceName) => ['A+', 'A', 'A-', 'B+', 'B', 'B-', 'C+'].includes(allVoices[voiceName].overallGrade)) return goodVoices as unknown as KokoroVoice[]; }
- src/index.ts:88-96 (schema)Tool schema definition including name, description, and empty input schema (no parameters required).const listVoicesTool: Tool = { name: "list_voices", description: "List all available voices for text-to-speech", inputSchema: { type: "object", properties: {}, required: [], }, };
- src/index.ts:355-360 (registration)Registration of listVoicesTool in the array returned by ListToolsRequest handler, making it discoverable by MCP clients.tools: [ textToSpeechTool, textToSpeechWithOptionsTool, listVoicesTool, getModelStatusTool, ],