optimize_launch_angle
Calculate optimal rocket launch angles to achieve maximum altitude or specific target ranges using aerospace engineering parameters.
Instructions
Optimize rocket launch angle for maximum altitude or range.
Args: rocket_geometry: Rocket geometry parameters target_range_m: Optional target range in meters optimize_for: Optimization objective ('altitude' or 'range') angle_bounds_deg: Launch angle bounds in degrees
Returns: JSON string with optimization results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rocket_geometry | Yes | ||
| target_range_m | No | ||
| optimize_for | No | altitude | |
| angle_bounds_deg | No |
Implementation Reference
- aerospace_mcp/tools/rockets.py:145-181 (handler)The primary handler function for the 'optimize_launch_angle' MCP tool. It processes input parameters, attempts to delegate to the integrations/rockets optimizer (which may not be implemented), and returns JSON-formatted results or error messages.def optimize_launch_angle( rocket_geometry: dict, target_range_m: float | None = None, optimize_for: Literal["altitude", "range"] = "altitude", angle_bounds_deg: tuple[float, float] = (45.0, 90.0), ) -> str: """Optimize rocket launch angle for maximum altitude or range. Args: rocket_geometry: Rocket geometry parameters target_range_m: Optional target range in meters optimize_for: Optimization objective ('altitude' or 'range') angle_bounds_deg: Launch angle bounds in degrees Returns: JSON string with optimization results """ try: from ..integrations.rockets import ( RocketGeometry, ) from ..integrations.rockets import ( optimize_launch_angle as _optimize, ) geometry = RocketGeometry(**rocket_geometry) result = _optimize(geometry, target_range_m, optimize_for, angle_bounds_deg) return json.dumps(result, indent=2) except ImportError: return "Launch optimization not available - install optimization packages" except Exception as e: logger.error(f"Launch optimization error: {str(e)}", exc_info=True) return f"Launch optimization error: {str(e)}"
- aerospace_mcp/fastmcp_server.py:113-113 (registration)Registration of the optimize_launch_angle tool with the FastMCP server instance.mcp.tool(optimize_launch_angle)
- aerospace_mcp/fastmcp_server.py:69-73 (registration)Import statement bringing the optimize_launch_angle handler into the server module for registration.from .tools.rockets import ( estimate_rocket_sizing, optimize_launch_angle, rocket_3dof_trajectory, )
- Dataclass schema for RocketGeometry, used to validate and structure the rocket_geometry dict input in the tool handler.@dataclass class RocketGeometry: """Rocket geometry parameters.""" dry_mass_kg: float # Rocket dry mass propellant_mass_kg: float # Initial propellant mass diameter_m: float # Rocket diameter length_m: float # Total rocket length cd: float = 0.3 # Drag coefficient thrust_curve: list[list[float]] = ( None # [[time_s, thrust_N], ...] or constant thrust )