text_to_speech
Convert text to speech using AI voices for audio generation, supporting custom voice models and webhook callbacks.
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 handler function that executes the text_to_speech tool: validates input, makes API call to /TextToSpeech, returns task info.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 definition for the text_to_speech tool, defining parameters text, voice_id (required), and optional webhook_url.{ 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 in the tool dispatch switch statement within CallToolRequestSchema handler.case "text_to_speech": return await this.handleTextToSpeech(args);