Skip to main content
Glama

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
NameRequiredDescriptionDefault
textYesText to convert to speech
voice_idYesVoice model ID to use (use get_all_voices to find IDs)
webhook_urlNoURL for callback upon completion

Implementation Reference

  • 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.`, }, ], }; }
  • 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);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pasie15/mcp-server-musicgpt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server