Skip to main content
Glama
baidu-xiling

Baidu Digital Human MCP Server

Official
by baidu-xiling

getText2AudioStatus

Check the progress and status of text-to-speech synthesis tasks by providing the task ID to monitor completion and retrieve results.

Instructions

#工具说明:查询音频合成进度。

样例1:

用户输入:查一下taskid为xxx的语音合成好了没有。 思考过程: 1.用户想要查询taskid为xxx的音频好了没有,需要使用“getText2AudioStatus”工具查询。 2.工具需要task ID这些参数。 3.task ID的值为xxx

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
taskIdNo语音合成任务ID

Implementation Reference

  • Registration of the 'getText2AudioStatus' tool using @mcp.tool decorator, including name, description with usage examples.
    @mcp.tool(
        name="getText2AudioStatus",
        description=(
        """
    #工具说明:查询音频合成进度。
    # 样例1:
    用户输入:查一下taskid为xxx的语音合成好了没有。
    思考过程:
    1.用户想要查询taskid为xxx的音频好了没有,需要使用“getText2AudioStatus”工具查询。
    2.工具需要task ID这些参数。
    3.task ID的值为xxx
        """)
    )
  • Handler function that executes the tool: obtains DHApiClient and calls its get_text2audio_status method with the taskId, returns MCPText2AudioStatusResponse.
    async def getText2AudioStatus(
            taskId: Annotated[str, Field(description="语音合成任务ID", default=None)]
    ) -> MCPText2AudioStatusResponse:
        """
        Retrieve the status of generated audio via the DH API.
    
        Args:
            taskId: 任务ID
        """
        try:
            client = await getDhClient()
            ret = await client.get_text2audio_status(taskId)
            return ret
        except Exception as e:
            return MCPText2AudioStatusResponse(error=str(e))
  • Pydantic model defining the output schema for the getText2AudioStatus tool response.
    class MCPText2AudioStatusResponse(BaseDHResponse):
        """ MCP 文本转语音状态响应 """
        taskId: Optional[str] = None
        status: Optional[str] = None
        failedCode: Optional[int] = None
        failedMessage: Optional[str] = None
        audioUrl: Optional[str] = None
        duration: Optional[int] = None
        textTimestamp: List[TextTimeStampInfo]
        createTime: Optional[str] = None
        updateTime: Optional[str] = None
  • Supporting method in DHApiClient that performs the actual API call to query text-to-audio status and transforms the response into MCP format.
    async def get_text2audio_status(self, taskId: str) -> MCPText2AudioStatusResponse:
        """Get the status of a generated video from the API."""
    
        async def api_call():
            endpoint = f"api/digitalhuman/open/v1/tts/text2audio/task?taskId={taskId}"
            return await self._make_request(endpoint)
    
        try:
            result = await api_call()
    
            validated_response = Text2AudioStatusResponse.model_validate(result)
            data = validated_response.result
    
            return MCPText2AudioStatusResponse(
                taskId=data.taskId,
                status=data.status,
                audioUrl=data.audioUrl,
                duration=data.duration,
                textTimestamp=data.textTimestamp,
                createTime=data.createTime,
                updateTime=data.updateTime,
                failedCode=validated_response.code,
                failedMessage="" if validated_response.message is None else validated_response.message.global_field,
            )
        except httpx.RequestError as exc:
            return MCPText2AudioStatusResponse(error=f"HTTP Request failed: {exc}")
        except httpx.HTTPStatusError as exc:
            return MCPText2AudioStatusResponse(
                error=f"HTTP Error: {exc.response.status_code} - {exc.response.text}"
            )
        except ValidationError as ve:
            return MCPText2AudioStatusResponse(error=f"ValidationError")
        except Exception as e:
            return MCPText2AudioStatusResponse(error=f"An unexpected error occurred: {e}")
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the tool queries progress but doesn't disclose behavioral traits like whether it's read-only, what the response format is (e.g., progress percentage, status codes), error handling, or rate limits. The example shows it requires a task ID, but this is already in the schema. It adds minimal context beyond basic operation.

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

Conciseness2/5

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

The description is poorly structured, mixing tool explanation with an example and 'thinking process' in Chinese. It includes redundant elements like '#工具说明:' and step-by-step reasoning that don't add value for an AI agent. Sentences like '思考过程:' and numbered steps are wasteful, making it longer than necessary without improving clarity.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a status-checking tool. It doesn't explain what the tool returns (e.g., status values like 'processing', 'completed', or error details), how to interpret results, or prerequisites (e.g., task ID must be valid). The example helps but doesn't cover behavioral context needed for effective use.

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 description coverage is 100%, with the single parameter 'taskId' documented as '语音合成任务ID' (audio synthesis task ID). The description adds no additional meaning beyond the schema—it reiterates that the tool needs 'task ID这些参数' (task ID parameters) in the example, but this doesn't enhance semantics. With high schema coverage, the baseline is 3, and the description doesn't compensate further.

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

Purpose4/5

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

The description clearly states the tool's purpose as '查询音频合成进度' (query audio synthesis progress), which is a specific verb+resource combination. It distinguishes from sibling tools like 'generateText2Audio' (which creates audio) and 'getVoices' (which lists voices). However, it doesn't explicitly differentiate from other status-checking siblings like 'getDh123VideoStatus' or 'getVoiceCloneStatus' beyond the audio focus.

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?

The description provides an example scenario ('查一下taskid为xxx的语音合成好了没有') that implies usage when a user wants to check if a specific audio synthesis task is complete. It doesn't explicitly state when NOT to use this tool or name alternatives (e.g., using other status tools for video tasks). The example guides usage but lacks explicit exclusions or comparisons to siblings.

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/baidu-xiling/mcp'

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