text_to_sound
Convert text to MP3 audio links for notifications across messaging platforms like Weixin, Telegram, Bark, and Lark. Supports multiple languages and adjustable speech speed.
Instructions
将一段文本转成mp3音频链接
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | 文本内容 | |
| lang | No | 目标语言,支持: en/zh/cte(粤语)/ara/de/fra/kor/pt/ru/spa/th, 建议根据文本内容选择 | en |
| speed | No | 语速,默认7 |
Implementation Reference
- mcp_notify/util.py:12-24 (handler)The core handler function for the 'text_to_sound' tool. It generates a Baidu Fanyi TTS mp3 audio URL based on input text, language code, and speech speed.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', })
- mcp_notify/util.py:13-16 (schema)Input schema using Pydantic Field for parameters: text (str), lang (str, default 'en'), speed (int, default 7). Includes descriptions in Chinese.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"), ):
- mcp_notify/util.py:8-11 (registration)Registers the text_to_sound tool with FastMCP using @mcp.tool decorator, providing Chinese title '文本转音频' (Text to Audio) and description.@mcp.tool( title="文本转音频", description="将一段文本转成mp3音频链接", )
- mcp_notify/__init__.py:23-23 (registration)Top-level registration invocation: calls util.add_tools(mcp) after creating FastMCP instance, which adds the text_to_sound tool.util.add_tools(mcp)