Skip to main content
Glama

文本转音频

text_to_sound

Converts text into an MP3 audio link. Supports multiple languages and adjustable speech speed for use in notifications.

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 actual handler function for the 'text_to_sound' tool. Takes text, lang, and speed parameters, builds a Baidu TTS URL using urlencode, and returns the mp3 audio link.
    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',
        })
  • Input schema/validation using Pydantic Field for the text, lang, and speed parameters of the text_to_sound tool.
        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"),
    ):
  • The add_tools function that registers text_to_sound (and potentially other tools) onto the FastMCP server via the @mcp.tool decorator.
    def add_tools(mcp: FastMCP, logger=None):
    
        @mcp.tool(
            title="文本转音频",
            description="将一段文本转成mp3音频链接",
        )
  • The import and call to util.add_tools(mcp) which triggers registration of the text_to_sound tool.
    util.add_tools(mcp)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. The description only states the conversion action without disclosing behavioral traits such as authentication needs, rate limits, or side effects. Minimal disclosure for a tool that likely has no destructive effects, but could be more transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. Perfectly concise and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is minimal and leaves ambiguity about the return format (link type, structure). No output schema is provided, so the description should clarify the output. For a simple tool, it is adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with detailed parameter descriptions. The description does not add extra meaning beyond the schema, so a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states '将一段文本转成mp3音频链接' (convert text to mp3 audio link), specifying the verb (convert) and resource (text to mp3 link). It distinguishes from sibling tools that are primarily for sending notifications/messages.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied: convert text to audio. No explicit guidance on when to use this tool vs alternatives or any exclusions. However, the function is distinct from message-sending siblings, so clarity is moderate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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