Skip to main content
Glama
inesaranab

Tavily Web Search MCP Server

by inesaranab

text_to_speech

Convert text to speech and save as MP3 files using customizable voice options for audio content creation.

Instructions

Convert the given text into speech and save as MP3 file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes
voice_idNoJBFqnCBsd6RMkjVDRZzb

Implementation Reference

  • server.py:31-57 (handler)
    The core handler function for the 'text_to_speech' tool, registered via @mcp.tool(). It converts input text to speech using the ElevenLabs API, saves the audio as a unique MP3 file, and returns the filename or error message.
    @mcp.tool() def text_to_speech(text: str, voice_id: str = "JBFqnCBsd6RMkjVDRZzb") -> str: """Convert the given text into speech and save as MP3 file""" import uuid try: # Generate unique filename audio_filename = f"speech_{uuid.uuid4().hex[:8]}.mp3" # Generate audio using ElevenLabs audio = client_elevenlabs.text_to_speech.convert( text=text, voice_id=voice_id, model_id="eleven_multilingual_v2" ) # Save audio to file with open(audio_filename, "wb") as f: for chunk in audio: if chunk: f.write(chunk) return f"Audio generated successfully! Saved as: {audio_filename}" except Exception as e: return f"Error generating speech: {str(e)}"

Other Tools

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/inesaranab/MCP'

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