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
| 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:8-24 (handler)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', })
- mcp_notify/__init__.py:23-23 (registration)Registration of tools from util.py, which includes the text_to_sound tool, by calling util.add_tools(mcp).util.add_tools(mcp)
- mcp_notify/util.py:13-16 (schema)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"), ):