approveOrder
Approve, reject, or cancel approval workflows for database change orders in Alibaba Cloud Data Management Service.
Instructions
Approve or reject an order in DMS. The workflow_instance_id can be obtained from getOrderInfo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_instance_id | Yes | Approval workflow ID, can be obtained from getOrderInfo API | |
| approval_type | Yes | Approval action: AGREE (approve), CANCEL (cancel), REJECT (reject) | |
| comment | No | Comment for the approval action | Order approved via MCP |
Implementation Reference
- Handler function that executes the approveOrder tool logic. It takes workflow_instance_id, approval_type (AGREE/CANCEL/REJECT), and an optional comment, then calls the Alibaba Cloud DMS ApproveOrder API.
async def approve_order( workflow_instance_id: int = Field(description="Approval workflow ID, can be obtained from getOrderInfo API"), approval_type: str = Field(description="Approval action: AGREE (approve), CANCEL (cancel), REJECT (reject)"), comment: Optional[str] = Field(default="Order approved via MCP", description="Comment for the approval action") ) -> Dict[str, Any]: client = create_client() req = dms_enterprise_20181101_models.ApproveOrderRequest( workflow_instance_id=workflow_instance_id, approval_type=approval_type ) if comment: req.comment = comment if mcp.state.real_login_uid: req.real_login_user_uid = mcp.state.real_login_uid try: resp = client.approve_order(req) return resp.body.to_map() except Exception as e: logger.error(f"Error in approve_order: {e}") raise - src/alibabacloud_dms_mcp_server/server.py:649-652 (registration)Registration of approveOrder tool in the configured DB toolset (when default_database_id is set). Maps the tool name 'approveOrder' to the approve_order handler function.
self.mcp.tool(name="approveOrder", description="Approve or reject an order in DMS. The workflow_instance_id can be obtained from getOrderInfo.", annotations={"title": "审批工单", "readOnlyHint": False})(approve_order) - src/alibabacloud_dms_mcp_server/server.py:785-787 (registration)Registration of approveOrder tool in the full toolset (when no default_database_id is set). Same mapping to the approve_order handler function.
self.mcp.tool(name="approveOrder", description="Approve or reject an order in DMS. The workflow_instance_id can be obtained from getOrderInfo.", annotations={"title": "审批工单", "readOnlyHint": False})(approve_order)