getLite2dGeneralStatus
Check the status of 2D digital human generation tasks or query available 2D avatars by providing an ID or using filter parameters.
Instructions
#工具说明:根据2D小样本数字人对应的人像ID,查询该任务目前的状态,也可以用于查询有哪些可用的2D人像。
样例1:
用户输入:查一下id为xxx的数字人好了没有。 思考过程: 1.用户想要查询人像生成任务的状态,需要使用“getLite2dGeneralStatus”工具。 2.工具需要,figureId,systemFigure,trainSuccess,pageNo,ppageSize这些参数。 3.用户提到了ID为xxx,所以figureId的值为xxx,现在不清楚这个任务的状态,所以trainSuccess的值不需要填,系统人像不需要生成过程,所以systemFigure值为false,其他为默认值。
样例2:
用户输入:我可以用哪些人像 思考过程: 1.用户想要查询哪些人像ID可以使用,需要使用“getLite2dGeneralStatus”工具。 2.工具需要,figureId,systemFigure,trainSuccess,pageNo,ppageSize这些参数。 3.查询可用人像,所以figureId为空,syste Figure为空,trainSuccess为ture,pageNo默认为1,避免漏查pageSize为最大值100。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| figureId | No | 人像ID | |
| systemFigure | No | 是否是平台公共人像,true返回平台公共人像,false返回定制人像,空查询全部 | |
| trainSuccess | No | 是否查询训练完成:true:只返回可用人像,false:只返回排队中、训练中或训练失败的定制人像,为空不进行过滤 |
Implementation Reference
- The MCP tool handler function that executes the logic: obtains DH API client and calls the underlying get_lite2d_general_status method.
async def getLite2dGeneralStatus( figureId: Annotated[str, Field(description="人像ID", default=None)], systemFigure: Annotated[Optional[bool], \ Field(description="是否是平台公共人像,true返回平台公共人像,false返回定制人像,空查询全部", default=None)], trainSuccess: Annotated[bool, \ Field(description="是否查询训练完成:true:只返回可用人像,false:只返回排队中、训练中或训练失败的定制人像,为空不进行过滤", default=None)]) \ -> MCPLite2DStatusResponse: """ Retrieve the status of a lite2d General video via the DH API. Args: figureId: 人像ID Returns: 任务状态 """ try: client = await getDhClient() ret = await client.get_lite2d_general_status(figureId, systemFigure, trainSuccess) return ret except Exception as e: return MCPVideoStatusResponse(error=str(e)) - src/mcp_server_baidu_digitalhuman/dhserver.py:463-482 (registration)MCP tool registration with name, description, and input schema defined via function parameters.
@mcp.tool( name="getLite2dGeneralStatus", description=( """ #工具说明:根据2D小样本数字人对应的人像ID,查询该任务目前的状态,也可以用于查询有哪些可用的2D人像。 # 样例1: 用户输入:查一下id为xxx的数字人好了没有。 思考过程: 1.用户想要查询人像生成任务的状态,需要使用“getLite2dGeneralStatus”工具。 2.工具需要,figureId,systemFigure,trainSuccess,pageNo,ppageSize这些参数。 3.用户提到了ID为xxx,所以figureId的值为xxx,现在不清楚这个任务的状态,所以trainSuccess的值不需要填,系统人像不需要生成过程,所以systemFigure值为false,其他为默认值。 # 样例2: 用户输入:我可以用哪些人像 思考过程: 1.用户想要查询哪些人像ID可以使用,需要使用“getLite2dGeneralStatus”工具。 2.工具需要,figureId,systemFigure,trainSuccess,pageNo,ppageSize这些参数。 3.查询可用人像,所以figureId为空,syste Figure为空,trainSuccess为ture,pageNo默认为1,避免漏查pageSize为最大值100。 """) ) - Pydantic model defining the output schema for the tool response.
class MCPLite2DStatusResponse(BaseDHResponse): """ MCP 2D小样本数字人状态响应 """ figureId: Optional[str] = None name: Optional[str] = None customizeType: Optional[str] = None systemFigure: Optional[bool] = None keepBackground: Optional[bool] = None gender: Optional[str] = None resolutionWidth: Optional[int] = None resolutionHeight: Optional[int] = None templateVideoUrl: Optional[str] = None maskVideoUrl: Optional[str] = None status: Optional[str] = None failedMessage: Optional[str] = None - Underlying DH API client helper method that performs the actual API call to query lite2d general status.
async def get_lite2d_general_status(self, figureId: str, systemFigure: bool = None, trainSuccess: bool = None) \ -> MCPLite2DStatusResponse: """ 2D 小样本数字人生成状态 """ async def api_call(): # fix in the future: systemFigure, trainSuccess endpoint = f"api/digitalhuman/open/v1/figure/lite2d/query?figureId={figureId}" return await self._make_request(endpoint) ret = await self._handle_api_request( api_call=api_call, response_model_class=Lite2dStatusResponse, mcp_response_class=MCPLite2DStatusResponse, error_msg="No video generation data returned.", figureId=lambda d: d.result[0].figureId, name=lambda d: d.result[0].name, status=lambda d: d.result[0].status, templateVideoUrl=lambda d: d.result[0].templateVideoUrl, failedMessage=lambda d: d.result[0].failedMessage, systemFigure=lambda d: d.result[0].systemFigure, gender=lambda d: d.result[0].gender, ) return ret