Skip to main content
Glama
nonead

nUR MCP Server

by nonead

generate_bezier_path

Generate smooth Bezier curve paths for robot motion planning by specifying control points and desired point density.

Instructions

生成贝塞尔曲线路径

参数:
- control_points: 控制点列表,格式为[{"x": 0, "y": 0, "z": 0, "rx": 0, "ry": 0, "rz": 0}, ...]
- num_points: 生成的路径点数量

返回:
- 路径点列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
control_pointsYes
num_pointsNo

Implementation Reference

  • The main MCP tool handler for 'generate_bezier_path'. Converts 6D control points from dicts to lists, calls AdvancedTrajectoryPlanner.generate_bezier_curve, converts back to dicts and wraps in return_msg.
    @mcp.tool()
    def generate_bezier_path(control_points: list, num_points: int = 50):
        """
        生成贝塞尔曲线路径
        
        参数:
        - control_points: 控制点列表,格式为[{"x": 0, "y": 0, "z": 0, "rx": 0, "ry": 0, "rz": 0}, ...]
        - num_points: 生成的路径点数量
        
        返回:
        - 路径点列表
        """
        try:
            if advanced_trajectory_planner is None:
                return return_msg("高级轨迹规划器未初始化")
            
            # 转换控制点格式
            points = [
                [p["x"], p["y"], p["z"], p["rx"], p["ry"], p["rz"]]
                for p in control_points
            ]
            
            # 生成贝塞尔曲线
            path = advanced_trajectory_planner.generate_bezier_curve(
                control_points=points,
                num_points=num_points
            )
            
            # 转换回字典格式
            result_path = []
            for point in path:
                result_path.append({
                    "x": point[0],
                    "y": point[1],
                    "z": point[2],
                    "rx": point[3],
                    "ry": point[4],
                    "rz": point[5]
                })
            
            return return_msg({"path": result_path})
        except Exception as e:
            logger.error(f"生成贝塞尔路径失败: {str(e)}")
            return return_msg(f"生成贝塞尔路径失败: {str(e)}")
  • Input/output schema defined by type annotations (control_points: list of dicts with x,y,z,rx,ry,rz; num_points: int=50) and docstring describing parameters and return (path: list of points).
    def generate_bezier_path(control_points: list, num_points: int = 50):
        """
        生成贝塞尔曲线路径
        
        参数:
        - control_points: 控制点列表,格式为[{"x": 0, "y": 0, "z": 0, "rx": 0, "ry": 0, "rz": 0}, ...]
        - num_points: 生成的路径点数量
        
        返回:
        - 路径点列表
        """
  • Tool registration via @mcp.tool() decorator on the handler function, which auto-registers with name 'generate_bezier_path' based on function name.
    @mcp.tool()
  • Initializes the global advanced_trajectory_planner instance (AdvancedTrajectoryPlanner()) called by the tool handler. Invoked in main().
    def initialize_extended_modules():
        """初始化所有扩展模块"""
        global multi_robot_coordinator, advanced_trajectory_planner
        global advanced_data_recorder, advanced_data_analyzer
    
        try:
            # 初始化多机器人协调器
            multi_robot_coordinator = AdvancedMultiRobotCoordinator()
            logger.info("高级多机器人协调器初始化成功")
    
            # 初始化高级轨迹规划器
            advanced_trajectory_planner = AdvancedTrajectoryPlanner()
            logger.info("高级轨迹规划器初始化成功")
    
            # 初始化高级数据记录器
            advanced_data_recorder = AdvancedDataRecorder()
            logger.info("高级数据记录器初始化成功")
    
            # 获取数据分析器实例(单例)
            advanced_data_analyzer = get_data_analyzer()
            logger.info("高级数据分析器初始化成功")
    
            return True
        except Exception as e:
            logger.error(f"初始化扩展模块失败: {str(e)}")
            return False
  • Core helper implementing Bezier curve generation via static method generate_bezier_curve, using calculate_bezier_point (Bernstein basis). Called internally by AdvancedTrajectoryPlanner (likely delegated). Handles position only (3D).
    class BezierCurveGenerator:
        """贝塞尔曲线生成器"""
        
        @staticmethod
        def calculate_bezier_point(t: float, points: List[List[float]]) -> List[float]:
            """
            计算贝塞尔曲线上的点
            
            Args:
                t: 参数 (0-1)
                points: 控制点列表
                
            Returns:
                List[float]: 曲线上的点 [x, y, z]
            """
            n = len(points) - 1
            result = [0.0, 0.0, 0.0]
            
            for i in range(n + 1):
                binomial = math.comb(n, i)
                weight = binomial * (t ** i) * ((1 - t) ** (n - i))
                
                result[0] += weight * points[i][0]
                result[1] += weight * points[i][1]
                result[2] += weight * points[i][2]
            
            return result
        
        @staticmethod
        def generate_bezier_curve(control_points: List[List[float]], 
                                 num_points: int = 100) -> List[List[float]]:
            """
            生成贝塞尔曲线
            
            Args:
                control_points: 控制点列表
                num_points: 生成的点数量
                
            Returns:
                List[List[float]]: 曲线上的点列表
            """
            curve_points = []
            for i in range(num_points):
                t = i / (num_points - 1) if num_points > 1 else 0.0
                point = BezierCurveGenerator.calculate_bezier_point(t, control_points)
                curve_points.append(point)
            
            return curve_points
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool generates a path and lists parameters and return values, but lacks behavioral details such as error handling, performance characteristics, or side effects. For a tool with computational tasks, this is a significant gap in transparency.

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 sized and front-loaded: it starts with the purpose, then lists parameters and returns in a structured format. Each sentence adds value without redundancy. It could be slightly more concise by integrating the parameter details more fluidly, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (generating Bézier curves with 2 parameters), no annotations, and no output schema, the description is moderately complete. It covers the purpose, parameter formats, and return type, but lacks details on error cases, mathematical behavior, or integration with sibling tools. For a computational tool in a robotics context, more context would be beneficial.

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

Parameters3/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 adds meaning by specifying the format of control_points as a list of objects with x, y, z, rx, ry, rz fields, and clarifies that num_points determines the number of generated path points. This provides essential semantics beyond the bare schema, but doesn't fully explain all aspects (e.g., units, constraints).

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's purpose: '生成贝塞尔曲线路径' (generate Bézier curve path). It specifies the verb ('生成' - generate) and resource ('贝塞尔曲线路径' - Bézier curve path), making it distinct from sibling tools like draw_circle or draw_rectangle. However, it doesn't explicitly differentiate from other path-generation tools if they existed, but in this context, it's sufficiently clear.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context, or comparisons with sibling tools (e.g., draw_circle for circular paths). The agent must infer usage based on the name and parameters alone, which is minimal guidance.

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