Skip to main content
Glama
cfrs2005

GS Robot MCP Server

by cfrs2005

execute_m_line_task_workflow

Automates the process of querying robot status, selecting tasks, and executing commands for M-line robot operations.

Instructions

Executes complete M-line robot task workflow.

Automated process: Status query → Task selection → Command execution

Args:
    serial_number: The serial number of the target robot.
    task_selection_criteria: Optional task selection criteria.

Returns:
    A dictionary containing the workflow execution result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serial_numberYes
task_selection_criteriaNo

Implementation Reference

  • MCP tool registration for execute_m_line_task_workflow using @mcp.tool() decorator. Delegates to mcp.execute_m_line_task_workflow method.
    @mcp.tool()
    async def execute_m_line_task_workflow(
        serial_number: str,
        task_selection_criteria: Optional[dict] = None
    ):
        """Executes complete M-line robot task workflow.
        
        Automated process: Status query → Task selection → Command execution
    
        Args:
            serial_number: The serial number of the target robot.
            task_selection_criteria: Optional task selection criteria.
    
        Returns:
            A dictionary containing the workflow execution result.
        """
        return await mcp.execute_m_line_task_workflow(
            serial_number=serial_number,
            task_selection_criteria=task_selection_criteria
        )
  • Handler method in GausiumMCP class that delegates to TaskExecutionEngine.execute_m_line_task.
    async def execute_m_line_task_workflow(
        self,
        serial_number: str,
        task_selection_criteria: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """
        执行M线机器人完整任务工作流。
        
        自动化流程:状态查询 → 任务选择 → 指令下发
        
        Args:
            serial_number: 机器人序列号
            task_selection_criteria: 任务选择条件
            
        Returns:
            工作流执行结果
        """
        return await self.task_engine.execute_m_line_task(
            serial_number=serial_number,
            task_selection_criteria=task_selection_criteria
        )
  • Core implementation: executes M-line robot task workflow by querying robot status, extracting available tasks, selecting a task based on criteria, and submitting a START_TASK command via the Gausium API.
    async def execute_m_line_task(
        self,
        serial_number: str,
        task_selection_criteria: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """
        执行M线机器人任务。
        
        工作流:
        1. 获取机器人状态
        2. 从状态中提取可执行任务列表
        3. 根据条件选择任务
        4. 通过Create Robot Command下发任务
        
        Args:
            serial_number: 机器人序列号
            task_selection_criteria: 任务选择条件
            
        Returns:
            任务执行结果
        """
        logger.info(f"Starting M-line task execution for robot: {serial_number}")
        
        async with GausiumAPIClient() as client:
            try:
                # 1. 获取机器人状态
                status = await client.call_endpoint(
                    'get_robot_status_v1',
                    path_params={'serial_number': serial_number}
                )
                
                # 2. 解析可执行任务列表
                available_tasks = self._extract_m_line_tasks(status)
                if not available_tasks:
                    raise ValueError("No executable tasks found in robot status")
                
                # 3. 选择任务
                selected_task = self._select_m_line_task(
                    available_tasks, 
                    task_selection_criteria or {}
                )
                
                # 4. 构建并下发任务指令
                command_result = await client.call_endpoint(
                    'create_command',
                    path_params={'serial_number': serial_number},
                    json_data={
                        "serialNumber": serial_number,
                        "remoteTaskCommandType": "START_TASK",
                        "commandParameter": {
                            "startTaskParameter": selected_task
                        }
                    }
                )
                
                logger.info(f"M-line task executed successfully: {command_result}")
                return command_result
                
            except Exception as e:
                logger.error(f"M-line task execution failed: {str(e)}")
                raise
  • Helper to extract available tasks from robot status response.
    def _extract_m_line_tasks(self, robot_status: Dict[str, Any]) -> List[Dict[str, Any]]:
        """
        从M线机器人状态中提取可执行任务列表。
        
        Args:
            robot_status: 机器人状态信息
            
        Returns:
            可执行任务列表
        """
        # TODO: 根据实际API响应格式实现
        # 这里需要根据实际的机器人状态响应格式来解析任务列表
        tasks = robot_status.get('available_tasks', [])
        if not tasks:
            # 如果没有直接的任务列表,尝试从其他字段解析
            # 需要根据实际响应格式调整
            logger.warning("No 'available_tasks' field found in robot status")
        
        return tasks
  • Helper to select a task from the available list based on criteria (returns first if no criteria or no match).
    def _select_m_line_task(
        self, 
        available_tasks: List[Dict[str, Any]], 
        criteria: Dict[str, Any]
    ) -> Dict[str, Any]:
        """
        根据条件选择M线任务。
        
        Args:
            available_tasks: 可用任务列表
            criteria: 选择条件
            
        Returns:
            选中的任务
        """
        if not criteria:
            # 如果没有指定条件,返回第一个任务
            return available_tasks[0]
        
        # TODO: 实现更复杂的任务选择逻辑
        # 可以根据任务名称、地图、清洁模式等条件筛选
        for task in available_tasks:
            if self._matches_criteria(task, criteria):
                return task
        
        # 如果没有匹配的任务,返回第一个
        return available_tasks[0]
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It mentions an automated process but does not detail side effects, destructive potential, permissions, rate limits, or error conditions. The steps are listed but not elaborated.

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

Conciseness3/5

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

The description is short but includes an artificial 'Args:' and 'Returns:' section that is not standard. The process steps add some value but could be integrated more concisely.

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 the tool complexity (workflow execution, 2 params, no output schema), the description lacks detail on prerequisites, outcomes, error handling, and return value shape. It is insufficient for a complete understanding.

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

Parameters2/5

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

Schema description coverage is 0%, so the description carries the burden. It adds basic meaning for serial_number and task_selection_criteria, but the latter is vague ('Optional task selection criteria') without specifying valid values, format, or behavior.

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 executes a complete M-line robot task workflow, with a specific verb and resource. The name and description differentiate it from sibling S-line workflow tools, though not explicitly.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as create_robot_command or execute_s_line_* workflows. The description only lists internal steps but does not provide context for selection.

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/cfrs2005/mcp-gs-robot'

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