UNPKG

minimax-mcp-js

Version:

Official MiniMax Model Context Protocol (MCP) JavaScript implementation that provides seamless integration with MiniMax's powerful AI capabilities including image generation, video generation, text-to-speech, and voice cloning APIs.

40 lines (39 loc) 1.37 kB
import { MinimaxRequestError } from '../exceptions/index.js'; export class VoiceAPI { api; constructor(api) { this.api = api; } /** * List all available voices * @param request Request parameters * @returns Voice list information */ async listVoices(request = {}) { try { // Send request const response = await this.api.post('/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 = []; const voiceCloneVoiceList = []; 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)}`); } } }