text_to_speech
Convert written text into spoken audio using AI-generated voices for accessibility, content creation, or audio production needs.
Instructions
Convert text to speech using AI voices
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to convert to speech | |
| voice_id | Yes | Voice model ID to use (use get_all_voices to find IDs) | |
| webhook_url | No | URL for callback upon completion |
Implementation Reference
- src/index.ts:921-940 (handler)The main handler function that executes the text_to_speech tool. Validates inputs, makes API call to /TextToSpeech endpoint, and returns task status information.private async handleTextToSpeech(args: any) { if (!args.text || !args.voice_id) { throw new McpError(ErrorCode.InvalidParams, "text and voice_id are required"); } const response = await this.axiosInstance.post("/TextToSpeech", { text: args.text, voice_id: args.voice_id, webhook_url: args.webhook_url, }); return { content: [ { type: "text", text: `Text-to-speech conversion started!\n\n${JSON.stringify(response.data, null, 2)}\n\nUse get_conversion_by_id with the task_id to check the status.`, }, ], }; }
- src/index.ts:229-250 (schema)Input schema and metadata definition for the text_to_speech tool, including required parameters text and voice_id.{ name: "text_to_speech", description: "Convert text to speech using AI voices", inputSchema: { type: "object" as const, properties: { text: { type: "string", description: "Text to convert to speech", }, voice_id: { type: "string", description: "Voice model ID to use (use get_all_voices to find IDs)", }, webhook_url: { type: "string", description: "URL for callback upon completion", }, }, required: ["text", "voice_id"], }, },
- src/index.ts:679-680 (registration)Registration of the text_to_speech handler in the central tool dispatch switch statement within CallToolRequestSchema handler.case "text_to_speech": return await this.handleTextToSpeech(args);
- src/index.ts:50-50 (helper)Enum constant 'TEXT_TO_SPEECH' used in conversionType for get_conversion_by_id helper tool to query TTS task status."TEXT_TO_SPEECH",