Skip to main content
Glama

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
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 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.`, }, ], }; }
  • 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);
  • Enum constant 'TEXT_TO_SPEECH' used in conversionType for get_conversion_by_id helper tool to query TTS task status.
    "TEXT_TO_SPEECH",

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