Skip to main content
Glama

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
NameRequiredDescriptionDefault
rocket_geometryYes
target_range_mNo
optimize_forNoaltitude
angle_bounds_degNo

Implementation Reference

  • 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)}"
  • Registration of the optimize_launch_angle tool with the FastMCP server instance.
    mcp.tool(optimize_launch_angle)
  • 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
        )

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/cheesejaguar/aerospace-mcp'

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