Skip to main content
Glama
IBM

Physics MCP Server

by IBM

check_angular_momentum_conservation

Verify whether total angular momentum is conserved by comparing initial and final values within a tolerance, indicating if external torques acted on the system.

Instructions

Verify conservation of angular momentum.

Checks whether total angular momentum is conserved. Angular momentum
is conserved when no external torques act on the system.

Args:
    initial_angular_momentum: Initial L [x, y, z] in kg⋅m²/s (or JSON string)
    final_angular_momentum: Final L [x, y, z] in kg⋅m²/s (or JSON string)
    tolerance: Tolerance (fraction, default 0.01 = 1%)

Returns:
    Dict containing:
        - initial_L_magnitude: Initial |L| in kg⋅m²/s
        - final_L_magnitude: Final |L| in kg⋅m²/s
        - L_difference: Difference [x, y, z]
        - L_difference_magnitude: |ΔL|
        - L_difference_percent: % difference
        - is_conserved: Whether L is conserved within tolerance

Tips for LLMs:
    - Conserved when no external torques (isolated rotation)
    - Ice skater spinning: pull arms in → I decreases → ω increases (L constant)
    - Gyroscope: resists changes to L direction
    - Planets orbiting: L conserved → elliptical orbits

Example - Figure skater:
    # Arms extended → Arms pulled in
    result = await check_angular_momentum_conservation(
        initial_angular_momentum=[0, 15, 0],  # kg⋅m²/s
        final_angular_momentum=[0, 15.05, 0],
        tolerance=0.01
    )

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
initial_angular_momentumYes
final_angular_momentumYes
toleranceNo

Implementation Reference

  • MCP @tool decorated async handler for check_angular_momentum_conservation. Parses input vectors (list or JSON string), delegates to core calculation function from ..conservation, and returns the response dict.
    @tool  # type: ignore[arg-type]
    async def check_angular_momentum_conservation(
        initial_angular_momentum: Union[list[float], str],
        final_angular_momentum: Union[list[float], str],
        tolerance: float = 0.01,
    ) -> dict:
        """Verify conservation of angular momentum.
    
        Checks whether total angular momentum is conserved. Angular momentum
        is conserved when no external torques act on the system.
    
        Args:
            initial_angular_momentum: Initial L [x, y, z] in kg⋅m²/s (or JSON string)
            final_angular_momentum: Final L [x, y, z] in kg⋅m²/s (or JSON string)
            tolerance: Tolerance (fraction, default 0.01 = 1%)
    
        Returns:
            Dict containing:
                - initial_L_magnitude: Initial |L| in kg⋅m²/s
                - final_L_magnitude: Final |L| in kg⋅m²/s
                - L_difference: Difference [x, y, z]
                - L_difference_magnitude: |ΔL|
                - L_difference_percent: % difference
                - is_conserved: Whether L is conserved within tolerance
    
        Tips for LLMs:
            - Conserved when no external torques (isolated rotation)
            - Ice skater spinning: pull arms in → I decreases → ω increases (L constant)
            - Gyroscope: resists changes to L direction
            - Planets orbiting: L conserved → elliptical orbits
    
        Example - Figure skater:
            # Arms extended → Arms pulled in
            result = await check_angular_momentum_conservation(
                initial_angular_momentum=[0, 15, 0],  # kg⋅m²/s
                final_angular_momentum=[0, 15.05, 0],
                tolerance=0.01
            )
        """
        # Parse inputs
        parsed_L_i = (
            json.loads(initial_angular_momentum)
            if isinstance(initial_angular_momentum, str)
            else initial_angular_momentum
        )
        parsed_L_f = (
            json.loads(final_angular_momentum)
            if isinstance(final_angular_momentum, str)
            else final_angular_momentum
        )
    
        from ..conservation import (
            AngularMomentumConservationCheckRequest,
            check_angular_momentum_conservation as check_L,
        )
    
        request = AngularMomentumConservationCheckRequest(
            initial_angular_momentum=parsed_L_i,
            final_angular_momentum=parsed_L_f,
            tolerance=tolerance,
        )
        response = check_L(request)
        return response.model_dump()
  • Core calculation function that verifies angular momentum conservation by computing vector magnitudes, difference, and comparing against tolerance. Returns AngularMomentumConservationCheckResponse.
    def check_angular_momentum_conservation(
        request: AngularMomentumConservationCheckRequest,
    ) -> AngularMomentumConservationCheckResponse:
        """Verify conservation of angular momentum.
    
        Args:
            request: Angular momentum conservation check request
    
        Returns:
            Angular momentum conservation analysis
        """
        L_initial = request.initial_angular_momentum
        L_final = request.final_angular_momentum
    
        L_initial_mag = _vector_magnitude(L_initial)
        L_final_mag = _vector_magnitude(L_final)
    
        L_diff = _vector_subtract(L_initial, L_final)
        L_diff_mag = _vector_magnitude(L_diff)
    
        L_diff_percent = (L_diff_mag / L_initial_mag * 100.0) if L_initial_mag > 0 else 0.0
    
        is_conserved = L_diff_mag <= request.tolerance * L_initial_mag
    
        return AngularMomentumConservationCheckResponse(
            initial_L_magnitude=L_initial_mag,
            final_L_magnitude=L_final_mag,
            L_difference=L_diff,
            L_difference_magnitude=L_diff_mag,
            L_difference_percent=L_diff_percent,
            is_conserved=is_conserved,
        )
  • AngularMomentumConservationCheckRequest Pydantic model defining input schema: initial/final angular momentum vectors [x,y,z] and tolerance.
    class AngularMomentumConservationCheckRequest(BaseModel):
        """Request for angular momentum conservation verification."""
    
        initial_angular_momentum: list[float] = Field(
            ..., description="Initial angular momentum [x, y, z] in kg⋅m²/s"
        )
        final_angular_momentum: list[float] = Field(
            ..., description="Final angular momentum [x, y, z] in kg⋅m²/s"
        )
        tolerance: float = Field(
            default=0.01, description="Tolerance for conservation check (fraction)", ge=0.0
        )
  • AngularMomentumConservationCheckResponse Pydantic model defining output schema: magnitudes, difference vector, percentage, and conservation boolean.
    class AngularMomentumConservationCheckResponse(BaseModel):
        """Response for angular momentum conservation verification."""
    
        initial_L_magnitude: float = Field(
            ..., description="Initial angular momentum magnitude in kg⋅m²/s"
        )
        final_L_magnitude: float = Field(..., description="Final angular momentum magnitude in kg⋅m²/s")
        L_difference: list[float] = Field(
            ..., description="Angular momentum difference [x, y, z] in kg⋅m²/s"
        )
        L_difference_magnitude: float = Field(
            ..., description="Angular momentum difference magnitude in kg⋅m²/s"
        )
        L_difference_percent: float = Field(
            ..., description="Angular momentum difference as percentage"
        )
        is_conserved: bool = Field(
            ..., description="Whether angular momentum is conserved within tolerance"
        )
  • Registration via importing .tools.conservation module in server.py. The @tool decorator on the async function auto-registers it with the MCP server framework.
    # 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,
        fluid_tools,
Behavior4/5

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

No annotations provided, but the description fully discloses the tool's behavior: it performs a conservation check computation, returning a dictionary of results. It implies no side effects, which aligns with the tool's nature.

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 sections (Args, Returns, Tips, Example) and front-loads the core purpose. However, the tips and example add length; minor trimming could improve conciseness.

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?

The description fully covers inputs, outputs (all fields of return dict), and provides educational context about angular momentum conservation, making it complete for an agent to use correctly without an output schema.

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 description adds extensive meaning beyond the schema: specifies units (kg⋅m²/s), format (JSON string), and default tolerance (0.01 = 1%), plus an example. The schema has 0% coverage, so the description fully compensates.

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 the verb 'verify' and the resource 'conservation of angular momentum', and the purpose is distinct from sibling tools like check_momentum_conservation (linear) and check_energy_conservation.

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

Usage Guidelines5/5

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

The description provides explicit when-to-use context (no external torques), examples (ice skater, gyroscope, planets), and a full example with input values, guiding the agent on proper usage.

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