Skip to main content
Glama

text_to_sound

Convert text to MP3 audio files for notifications, supporting multiple languages and adjustable speech speed.

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 an MP3 audio URL from text using Baidu Fanyi TTS API, with parameters for language and speed. Includes inline schema definitions via Pydantic Field.
    @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', })
  • Registers the tools from util.py (including text_to_sound) by calling util.add_tools(mcp) on the FastMCP instance.
    util.add_tools(mcp)
  • mcp_notify/util.py:6-6 (registration)
    The add_tools function in util.py that defines and registers the text_to_sound tool using @mcp.tool() decorator.
    def add_tools(mcp: FastMCP):

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