Skip to main content
Glama
nonead

nUR MCP Server

by nonead

generate_robot_report

Generate operational reports for Universal Robots by specifying robot ID, time range, and output path to document performance data.

Instructions

生成机器人运行报告

参数:
- robot_id: 机器人ID
- start_time: 开始时间戳
- end_time: 结束时间戳
- report_path: 报告保存路径

返回:
- 报告生成结果

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
robot_idYes
start_timeNo
end_timeNo
report_pathNo

Implementation Reference

  • The MCP tool handler function decorated with @mcp.tool(), implementing generate_robot_report by calling advanced_data_analyzer.generate_report and handling errors.
    @mcp.tool()
    def generate_robot_report(robot_id: str, start_time: float = None, end_time: float = None, report_path: str = None):
        """
        生成机器人运行报告
        
        参数:
        - robot_id: 机器人ID
        - start_time: 开始时间戳
        - end_time: 结束时间戳
        - report_path: 报告保存路径
        
        返回:
        - 报告生成结果
        """
        try:
            if advanced_data_analyzer is None:
                return return_msg("高级数据分析器未初始化")
            
            # 生成报告
            report = advanced_data_analyzer.generate_report(
                robot_id=robot_id,
                start_time=start_time,
                end_time=end_time,
                report_path=report_path
            )
            
            if 'error' in report:
                return return_msg({"error": report['error']})
            
            return return_msg({"success": True, "report": report})
        except Exception as e:
            logger.error(f"生成机器人报告失败: {str(e)}")
            return return_msg(f"生成机器人报告失败: {str(e)}")
  • The core helper method in AdvancedDataAnalyzer class that generates the comprehensive robot report by loading data, performing multiple analyses (statistical, performance, energy, anomaly, correlation), compiling results into a JSON report, and optionally saving to file.
    def generate_report(self, 
                       start_time: Optional[float] = None,
                       end_time: Optional[float] = None,
                       robot_id: Optional[str] = None,
                       report_path: Optional[str] = None) -> Dict[str, Any]:
        """
        生成综合分析报告
        
        Args:
            start_time: 开始时间
            end_time: 结束时间
            robot_id: 机器人ID
            report_path: 报告保存路径
            
        Returns:
            Dict[str, Any]: 报告内容
        """
        # 加载数据
        df = self.load_data(
            start_time=start_time,
            end_time=end_time,
            robot_id=robot_id
        )
        
        if df.empty:
            return {'error': '没有找到数据'}
        
        report = {
            'metadata': {
                'generated_at': time.time(),
                'generated_at_str': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
                'robot_id': robot_id,
                'time_range': {
                    'start': start_time,
                    'end': end_time
                },
                'data_points': len(df)
            },
            'analyses': {}
        }
        
        # 执行各种分析
        
        # 1. 统计分析
        numeric_cols = df.select_dtypes(include=['float64', 'int64']).columns.tolist()
        if numeric_cols:
            report['analyses']['statistical'] = self.analyze(
                df,
                AnalysisType.STATISTICAL,
                {'columns': numeric_cols[:5]}  # 分析前5个数值列
            )
        
        # 2. 性能分析(如果有相关列)
        if 'operation_type' in df.columns and 'execution_time' in df.columns:
            report['analyses']['performance'] = self.analyze(
                df,
                AnalysisType.PERFORMANCE,
                {'operation_column': 'operation_type', 'duration_column': 'execution_time'}
            )
        
        # 3. 能耗分析(如果有相关列)
        if 'voltage' in df.columns and 'current' in df.columns:
            report['analyses']['energy'] = self.analyze(
                df,
                AnalysisType.ENERGY,
                {'voltage_column': 'voltage', 'current_column': 'current'}
            )
        
        # 4. 异常检测(对温度等关键参数)
        temperature_cols = [col for col in df.columns if 'temp' in col.lower() or 'temperature' in col.lower()]
        if temperature_cols:
            report['analyses']['anomalies'] = self.analyze(
                df,
                AnalysisType.ANOMALY,
                {'columns': temperature_cols}
            )
        
        # 5. 相关性分析
        report['analyses']['correlation'] = self.analyze(
            df,
            AnalysisType.CORRELATION
        )
        
        # 保存报告
        if report_path:
            os.makedirs(os.path.dirname(report_path), exist_ok=True)
            with open(report_path, 'w', encoding='utf-8') as f:
                json.dump(report, f, ensure_ascii=False, indent=2)
            logger.info(f"分析报告已保存到: {report_path}")
        
        return report
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 '返回: 报告生成结果' (return: report generation result), which hints at output but doesn't specify format (e.g., file path, success/failure status, error handling). The description doesn't disclose whether this is a read-only operation, whether it creates files, what permissions are needed, or any rate limits. For a tool with 4 parameters and no annotations, this is insufficient behavioral context.

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

Conciseness4/5

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

The description is appropriately concise with three brief sections (purpose, parameters, return). Each sentence earns its place, though the parameter section could be more informative. The structure is clear and front-loaded with the main purpose first.

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 4 parameters with 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain the tool's behavior sufficiently for an agent to use it correctly. The return statement is vague ('报告生成结果'), and key details like file creation, error conditions, and parameter interactions are missing. For a report generation tool with multiple inputs, this leaves significant gaps.

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 must compensate. It lists parameters with brief Chinese labels but adds minimal semantic value: 'robot_id: 机器人ID' just repeats the parameter name in Chinese. No format details (e.g., timestamp units, path syntax), constraints, or examples are provided. The description doesn't explain what happens with null defaults for start_time, end_time, and report_path. With 4 parameters at 0% schema coverage, this is inadequate.

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

Purpose3/5

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

The description states '生成机器人运行报告' (generate robot operation report), which is a clear verb+resource combination. However, it doesn't distinguish this tool from sibling tools like 'analyze_robot_data' or 'compare_robots_performance' that might also involve robot data analysis. The purpose is understandable but lacks differentiation from similar-sounding tools.

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 is provided about when to use this tool versus alternatives. The description doesn't mention prerequisites, appropriate contexts, or exclusions. With sibling tools like 'analyze_robot_data' and 'compare_robots_performance' available, the agent has no help determining which tool to select for report generation versus other data analysis tasks.

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/nonead/nUR-MCP-SERVER'

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