create_collaborative_task
Create multi-robot collaborative tasks by assigning operations to specific robots and defining task dependencies for coordinated industrial automation workflows.
Instructions
创建多机器人协同任务
参数:
- task_name: 任务名称
- robot_assignments: 机器人任务分配,格式为{"robot_id": {"operation": "...", "params": {...}}}
- dependencies: 任务依赖关系列表,格式为[{"from": "task1", "to": "task2"}]
返回:
- 任务创建结果
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_name | Yes | ||
| robot_assignments | Yes | ||
| dependencies | No |
Implementation Reference
- This is the MCP tool handler function for 'create_collaborative_task'. It is decorated with @mcp.tool(), making it both the registration and the execution logic. The function creates a collaborative task using the AdvancedMultiRobotCoordinator instance.@mcp.tool() def create_collaborative_task(task_name: str, robot_assignments: dict, dependencies: list = None): """ 创建多机器人协同任务 参数: - task_name: 任务名称 - robot_assignments: 机器人任务分配,格式为{"robot_id": {"operation": "...", "params": {...}}} - dependencies: 任务依赖关系列表,格式为[{"from": "task1", "to": "task2"}] 返回: - 任务创建结果 """ try: if multi_robot_coordinator is None: return return_msg("多机器人协调器未初始化") # 创建任务 task_id = multi_robot_coordinator.create_collaboration_task( task_name=task_name, robot_assignments=robot_assignments, dependencies=dependencies ) return return_msg(f"协同任务创建成功,任务ID: {task_id}") except Exception as e: logger.error(f"创建协同任务失败: {str(e)}") return return_msg(f"创建协同任务失败: {str(e)}")