Skip to main content
Glama
IBM

Physics MCP Server

by IBM

calculate_orbital_period

Calculate orbital period and velocity for circular orbits using Kepler's Third Law. Input orbital radius and central body mass to get period in seconds, hours, or days.

Instructions

Calculate orbital period: T = 2π√(r³/GM).

Kepler's Third Law for circular orbits. Period depends on orbital
radius and central body mass.

Args:
    orbital_radius: Orbital radius in meters (from center of central body)
    central_mass: Mass of central body in kg
    gravitational_constant: G in m³/(kg⋅s²) (default 6.674e-11)

Returns:
    Dict containing:
        - period: Orbital period in seconds
        - orbital_velocity: v in m/s
        - period_hours: Period in hours (for convenience)
        - period_days: Period in days (for convenience)

Tips for LLMs:
    - Higher orbit → longer period
    - More massive central body → shorter period
    - Earth: M = 5.972e24 kg, R = 6.371e6 m
    - Moon orbit: r ≈ 384,400 km, T ≈ 27.3 days
    - ISS orbit: r ≈ 6,771 km (altitude 400 km), T ≈ 90 minutes

Example - ISS orbit:
    result = await calculate_orbital_period(
        orbital_radius=6.771e6,  # meters
        central_mass=5.972e24  # Earth mass (kg)
    )
    # T ≈ 5,558 seconds ≈ 92.6 minutes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orbital_radiusYes
central_massYes
gravitational_constantNo

Implementation Reference

  • Core calculation function implementing Kepler's Third Law: T = 2π√(r³/GM). Computes orbital period, velocity, and convenience conversions to hours/days.
    def calculate_orbital_period(request: OrbitalPeriodRequest) -> OrbitalPeriodResponse:
        """Calculate orbital period using Kepler's Third Law: T = 2π√(r³/GM).
    
        Args:
            request: Orbital period request
    
        Returns:
            Orbital period and velocity
        """
        r = request.orbital_radius
        M = request.central_mass
        G = request.gravitational_constant
    
        # T = 2π√(r³/GM)
        T = 2.0 * math.pi * math.sqrt((r * r * r) / (G * M))
    
        # Orbital velocity: v = 2πr/T
        v = (2.0 * math.pi * r) / T
    
        T_hours = T / 3600.0
        T_days = T / 86400.0
    
        return OrbitalPeriodResponse(
            period=T, orbital_velocity=v, period_hours=T_hours, period_days=T_days
        )
  • MCP tool endpoint decorated with @tool. Accepts orbital_radius, central_mass, and optional gravitational_constant. Delegates to core calculation function and returns dict.
    @tool  # type: ignore[arg-type]
    async def calculate_orbital_period(
        orbital_radius: float,
        central_mass: float,
        gravitational_constant: float = 6.674e-11,
    ) -> dict:
        """Calculate orbital period: T = 2π√(r³/GM).
    
        Kepler's Third Law for circular orbits. Period depends on orbital
        radius and central body mass.
    
        Args:
            orbital_radius: Orbital radius in meters (from center of central body)
            central_mass: Mass of central body in kg
            gravitational_constant: G in m³/(kg⋅s²) (default 6.674e-11)
    
        Returns:
            Dict containing:
                - period: Orbital period in seconds
                - orbital_velocity: v in m/s
                - period_hours: Period in hours (for convenience)
                - period_days: Period in days (for convenience)
    
        Tips for LLMs:
            - Higher orbit → longer period
            - More massive central body → shorter period
            - Earth: M = 5.972e24 kg, R = 6.371e6 m
            - Moon orbit: r ≈ 384,400 km, T ≈ 27.3 days
            - ISS orbit: r ≈ 6,771 km (altitude 400 km), T ≈ 90 minutes
    
        Example - ISS orbit:
            result = await calculate_orbital_period(
                orbital_radius=6.771e6,  # meters
                central_mass=5.972e24  # Earth mass (kg)
            )
            # T ≈ 5,558 seconds ≈ 92.6 minutes
        """
        from ..circular_motion import OrbitalPeriodRequest, calculate_orbital_period as calc_orbit
    
        request = OrbitalPeriodRequest(
            orbital_radius=orbital_radius,
            central_mass=central_mass,
            gravitational_constant=gravitational_constant,
        )
        response = calc_orbit(request)
        return response.model_dump()
  • Pydantic request model with orbital_radius, central_mass (both > 0), and optional gravitational_constant (default 6.674e-11).
    class OrbitalPeriodRequest(BaseModel):
        """Request for orbital period calculation."""
    
        orbital_radius: float = Field(..., description="Orbital radius in meters", gt=0.0)
        central_mass: float = Field(..., description="Mass of central body in kg", gt=0.0)
        gravitational_constant: float = Field(
            default=6.674e-11, description="Gravitational constant G in m³/(kg⋅s²)"
        )
  • Pydantic response model with period (seconds), orbital_velocity, period_hours, and period_days.
    class OrbitalPeriodResponse(BaseModel):
        """Response for orbital period calculation."""
    
        period: float = Field(..., description="Orbital period in seconds")
        orbital_velocity: float = Field(..., description="Orbital velocity in m/s")
        period_hours: float = Field(..., description="Orbital period in hours (for convenience)")
        period_days: float = Field(..., description="Orbital period in days (for convenience)")
  • Server imports the circular_motion tools module, which triggers registration of the @tool-decorated calculate_orbital_period function.
    # Import all tools modules to register their @tool decorated functions
    from .tools import (
        basic,
        rotational,
        oscillations,
        circular_motion,
        collisions,
        conservation,
        fluid as fluid_tools,
        kinematics_tools,
        statics,
        convert_units as unit_conversion_tools,
    )
    
    # Silence unused import warnings - these imports register @tool decorated functions
    _ = (
        basic,
        unit_conversion_tools,
        rotational,
        oscillations,
        circular_motion,
        collisions,
        conservation,
Behavior5/5

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

No annotations are provided, so description carries full burden. It fully discloses the formula, all parameters, return values, and limitations (circular orbits only). Tips and examples further clarify behavior.

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 well-structured with formula, Args, Returns, Tips, and Example sections, but is somewhat verbose. Could be slightly more concise without losing key information.

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

Completeness5/5

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

Given no output schema and no annotations, the description is remarkably complete: it explains purpose, all parameters, full return dictionary with four fields, helpful tips, and a worked example. No gaps for an LLM to infer.

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

Parameters5/5

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

The input schema has 0% description coverage, but the description explains each parameter in detail, including units, default for gravitational_constant, and provides concrete examples with values.

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

Purpose5/5

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

The description clearly states it calculates orbital period using Kepler's Third Law for circular orbits, with specific verb 'Calculate orbital period' and equation. It is distinct from sibling tools like 'analyze_circular_orbit' which likely does more comprehensive analysis.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool (calculating orbital period for circular orbits) but does not explicitly mention when not to use it or compare to alternatives like 'analyze_circular_orbit'.

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/IBM/chuk-mcp-physics'

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