Skip to main content
Glama
IBM

Physics MCP Server

by IBM

calculate_angular_momentum

Compute angular momentum vector and magnitude from moment of inertia and angular velocity, enabling analysis of rotational dynamics and conservation.

Instructions

Calculate angular momentum: L = I × ω.

Angular momentum is the rotational equivalent of linear momentum.
It's conserved in the absence of external torques (like ice skater spinning).

Args:
    moment_of_inertia: Moment of inertia in kg⋅m²
    angular_velocity_x: X component of angular velocity in rad/s
    angular_velocity_y: Y component of angular velocity in rad/s
    angular_velocity_z: Z component of angular velocity in rad/s

Returns:
    Dict containing:
        - angular_momentum: L vector [x, y, z] in kg⋅m²/s
        - magnitude: L magnitude in kg⋅m²/s

Tips for LLMs:
    - Angular momentum is conserved when no external torques act
    - Ice skater pulls arms in → I decreases → ω increases (L constant)
    - Gyroscopes resist changes in angular momentum direction

Example - Spinning figure skater:
    # Arms extended: I = 3.0 kg⋅m², ω = 5 rad/s
    result = await calculate_angular_momentum(
        moment_of_inertia=3.0,
        angular_velocity_x=0.0,
        angular_velocity_y=5.0,
        angular_velocity_z=0.0
    )
    # L = 15 kg⋅m²/s (conserved when arms pulled in)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
moment_of_inertiaYes
angular_velocity_xYes
angular_velocity_yYes
angular_velocity_zYes

Implementation Reference

  • Core calculation function for angular momentum. Computes L = I * ω (scalar multiplication of moment of inertia with each component of angular velocity vector), then calculates the magnitude. Returns AngularMomentumResponse with the L vector and magnitude.
    def calculate_angular_momentum(request: AngularMomentumRequest) -> AngularMomentumResponse:
        """Calculate angular momentum: L = I × ω.
    
        For simplicity, assumes angular velocity is about a principal axis.
    
        Args:
            request: Angular momentum request
    
        Returns:
            Angular momentum vector and magnitude
        """
        inertia = request.moment_of_inertia
        omega = request.angular_velocity
    
        # L = I * ω (scalar multiplication for simple case)
        L = [inertia * w for w in omega]
        magnitude = math.sqrt(sum(L_component * L_component for L_component in L))
    
        return AngularMomentumResponse(angular_momentum=L, magnitude=magnitude)
  • AngularMomentumRequest and AngularMomentumResponse Pydantic models. Request has moment_of_inertia (float > 0) and angular_velocity (list of 3 floats). Response has angular_momentum (list of 3 floats) and magnitude (float).
    class AngularMomentumRequest(BaseModel):
        """Request for angular momentum calculation."""
    
        moment_of_inertia: float = Field(..., description="Moment of inertia in kg⋅m²", gt=0.0)
        angular_velocity: list[float] = Field(..., description="Angular velocity [x, y, z] in rad/s")
    
    
    class AngularMomentumResponse(BaseModel):
        """Response for angular momentum calculation."""
    
        angular_momentum: list[float] = Field(
            ..., description="Angular momentum vector [x, y, z] in kg⋅m²/s"
        )
        magnitude: float = Field(..., description="Angular momentum magnitude in kg⋅m²/s")
  • MCP tool endpoint for calculate_angular_momentum. Decorated with @tool, takes moment_of_inertia and angular_velocity components as individual float arguments, constructs an AngularMomentumRequest, delegates to the core calculation function, and returns the response dict.
    @tool  # type: ignore[arg-type]
    async def calculate_angular_momentum(
        moment_of_inertia: float,
        angular_velocity_x: float,
        angular_velocity_y: float,
        angular_velocity_z: float,
    ) -> dict:
        """Calculate angular momentum: L = I × ω.
    
        Angular momentum is the rotational equivalent of linear momentum.
        It's conserved in the absence of external torques (like ice skater spinning).
    
        Args:
            moment_of_inertia: Moment of inertia in kg⋅m²
            angular_velocity_x: X component of angular velocity in rad/s
            angular_velocity_y: Y component of angular velocity in rad/s
            angular_velocity_z: Z component of angular velocity in rad/s
    
        Returns:
            Dict containing:
                - angular_momentum: L vector [x, y, z] in kg⋅m²/s
                - magnitude: L magnitude in kg⋅m²/s
    
        Tips for LLMs:
            - Angular momentum is conserved when no external torques act
            - Ice skater pulls arms in → I decreases → ω increases (L constant)
            - Gyroscopes resist changes in angular momentum direction
    
        Example - Spinning figure skater:
            # Arms extended: I = 3.0 kg⋅m², ω = 5 rad/s
            result = await calculate_angular_momentum(
                moment_of_inertia=3.0,
                angular_velocity_x=0.0,
                angular_velocity_y=5.0,
                angular_velocity_z=0.0
            )
            # L = 15 kg⋅m²/s (conserved when arms pulled in)
        """
        from ..rotational import AngularMomentumRequest, calculate_angular_momentum as calc_L
    
        request = AngularMomentumRequest(
            moment_of_inertia=moment_of_inertia,
            angular_velocity=[angular_velocity_x, angular_velocity_y, angular_velocity_z],
        )
        response = calc_L(request)
        return response.model_dump()
  • Import of calculate_angular_momentum from chuk_mcp_physics.tools.rotational in the example usage file.
    from chuk_mcp_physics.tools.rotational import (
        calculate_torque,
        calculate_moment_of_inertia,
        calculate_angular_momentum,
        calculate_rotational_kinetic_energy,
        calculate_angular_acceleration,
    )
  • Unit test for the core calculate_angular_momentum function. Tests with I=3.0, ω=[0,5,0] verifying L_y=15.0 and magnitude=15.0.
    class TestAngularMomentum:
        def test_simple_angular_momentum(self):
            """Test angular momentum calculation."""
            request = AngularMomentumRequest(
                moment_of_inertia=3.0,
                angular_velocity=[0.0, 5.0, 0.0],
            )
            result = calculate_angular_momentum(request)
    
            # L = I * ω
            assert abs(result.angular_momentum[1] - 15.0) < 0.01
            assert abs(result.magnitude - 15.0) < 0.01
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the return format (vector and magnitude) and provides an example, but does not mention side effects, error conditions, or behavior for edge cases like zero moment of inertia. The conservation context is informative but not behavioral.

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

Conciseness3/5

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

The description is somewhat verbose, including educational tips and a detailed example that could be shortened. However, it is well-structured with sections for Args, Returns, Tips, and Example, aiding readability.

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

Completeness4/5

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

Given the lack of output schema and annotations, the description provides sufficient context: parameter details, return format, a concrete example, and educational notes on conservation. It covers most aspects needed to use the tool correctly, though error handling and precision are not addressed.

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

Parameters4/5

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

The schema has 0% description coverage, so the description compensates by listing each parameter with units (e.g., 'Moment of inertia in kg⋅m²', 'angular velocity components in rad/s'). This adds meaningful context beyond the schema types and is essential for correct usage.

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 'Calculate angular momentum' and provides the formula L = I × ω, effectively communicating the tool's purpose. While it distinguishes from linear momentum through the formula, it does not explicitly differentiate from sibling rotational tools like calculate_torque or calculate_moment_of_inertia.

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

Usage Guidelines3/5

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

The description explains the tool's function and includes conservation tips, but lacks explicit guidance on when to use this tool versus alternatives such as calculate_momentum (linear) or calculate_angular_acceleration. The usage is implied by the name and formula, but no when-not-to-use conditions are provided.

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