list_voices
Explore and retrieve all available voice options for text-to-speech and voice cloning services within the MiniMax MCP JS environment. Specify voice types to filter results.
Instructions
List all available voices. Only supported when api_host is https://api.minimax.chat.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| voiceType | No | Type of voices to list, values: ["all", "system", "voice_cloning"] | all |
Implementation Reference
- src/mcp-server.ts:272-295 (handler)Handler function for the 'list_voices' MCP tool. Calls voiceApi.listVoices(params) and returns formatted success or error message.async (params) => { try { // No need to update configuration from request parameters in stdio mode const result = await this.voiceApi.listVoices(params); return { content: [ { type: 'text', text: `Success. System voices: ${result.systemVoices.join(', ')}, Cloned voices: ${result.voiceCloneVoices.join(', ')}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Failed to list voices: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } },
- src/mcp-server.ts:261-297 (registration)Registers the 'list_voices' tool with the MCP server, including description, input schema using Zod, and the handler function.private registerListVoicesTool(): void { this.server.tool( 'list_voices', 'List all available voices. Only supported when api_host is https://api.minimax.chat.', { voiceType: z .string() .optional() .default('all') .describe('Type of voices to list, values: ["all", "system", "voice_cloning"]'), }, async (params) => { try { // No need to update configuration from request parameters in stdio mode const result = await this.voiceApi.listVoices(params); return { content: [ { type: 'text', text: `Success. System voices: ${result.systemVoices.join(', ')}, Cloned voices: ${result.voiceCloneVoices.join(', ')}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Failed to list voices: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }, ); }
- src/types/index.ts:60-62 (schema)TypeScript interface defining the input parameters for list_voices request.export interface ListVoicesRequest { voiceType?: string; }
- src/api/voice.ts:17-47 (helper)VoiceAPI.listVoices method: Makes API call to MiniMax /v1/get_voice endpoint, processes response, formats voice lists, and returns structured data used by the tool handler.async listVoices(request: ListVoicesRequest = {}): Promise<{ systemVoices: string[], voiceCloneVoices: string[] }> { try { // Send request const response = await this.api.post<any>('/v1/get_voice', { voice_type: request.voiceType || 'all' }); // Process response const systemVoices = response?.system_voice || []; const voiceCloneVoices = response?.voice_cloning || []; // Format voice information const systemVoiceList: string[] = []; const voiceCloneVoiceList: string[] = []; for (const voice of systemVoices) { systemVoiceList.push(`Name: ${voice.voice_name}, ID: ${voice.voice_id}`); } for (const voice of voiceCloneVoices) { voiceCloneVoiceList.push(`Name: ${voice.voice_name}, ID: ${voice.voice_id}`); } return { systemVoices: systemVoiceList, voiceCloneVoices: voiceCloneVoiceList }; } catch (error) { throw new MinimaxRequestError(`Failed to list voices: ${String(error)}`); } }