Skip to main content
Glama

text_to_sound

Convert text to MP3 audio files for notifications and messaging across platforms. Specify language and speed to generate shareable audio links from text content.

Instructions

将一段文本转成mp3音频链接

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes文本内容
langNo目标语言,支持: en/zh/cte(粤语)/ara/de/fra/kor/pt/ru/spa/th, 建议根据文本内容选择en
speedNo语速,默认7

Implementation Reference

  • The handler function for the 'text_to_sound' tool. It generates a Baidu Translate TTS URL based on input text, language, and speed.
    @mcp.tool( title="文本转音频", description="将一段文本转成mp3音频链接", ) def text_to_sound( text: str = Field(description="文本内容"), lang: str = Field("en", description="目标语言,支持: en/zh/cte(粤语)/ara/de/fra/kor/pt/ru/spa/th, 建议根据文本内容选择"), speed: int = Field(7, description="语速,默认7"), ): if not text: return "" return 'https://fanyi.baidu.com/gettts?' + urlencode({ 'lan': lang, 'spd': speed, 'text': text, 'source': 'web', })
  • Registration of tools from util.py, which includes the text_to_sound tool, by calling util.add_tools(mcp).
    util.add_tools(mcp)
  • Pydantic Field definitions for the tool's input schema: text, lang, speed.
    text: str = Field(description="文本内容"), lang: str = Field("en", description="目标语言,支持: en/zh/cte(粤语)/ara/de/fra/kor/pt/ru/spa/th, 建议根据文本内容选择"), speed: int = Field(7, description="语速,默认7"), ):

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/aahl/mcp-notify'

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