Skip to main content
Glama
IBM

Physics MCP Server

by IBM

calculate_pressure_at_depth

Calculate total and gauge pressure at a given depth in a fluid, accounting for fluid density and atmospheric pressure. Useful for scuba diving, underwater engineering, and fluid statics problems.

Instructions

Calculate pressure at depth: P = P_atm + ρgh.

Hydrostatic pressure increases with depth.

Args:
    depth: Depth below surface in meters
    fluid_density: Fluid density in kg/m³ (water=1000, seawater=1025)
    atmospheric_pressure: Pressure at surface in Pascals (default 101325)
    gravity: Gravitational acceleration in m/s² (default 9.81)

Returns:
    Dict containing:
        - total_pressure: Total pressure in Pascals
        - gauge_pressure: Pressure above atmospheric in Pascals
        - pressure_atmospheres: Pressure in atmospheres (1 atm = 101325 Pa)

Example - Scuba diving at 30m:
    result = await calculate_pressure_at_depth(
        depth=30,  # meters
        fluid_density=1025,  # seawater
        atmospheric_pressure=101325
    )
    # Result: ~4 atmospheres

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthYes
fluid_densityYes
atmospheric_pressureNo
gravityNo

Implementation Reference

  • MCP tool handler: 'calculate_pressure_at_depth' - async function decorated with @tool that receives parameters (depth, fluid_density, atmospheric_pressure, gravity) and delegates to the core calculation function.
    @tool  # type: ignore[arg-type]
    async def calculate_pressure_at_depth(
        depth: float,
        fluid_density: float,
        atmospheric_pressure: float = 101325.0,
        gravity: float = 9.81,
    ) -> dict:
        """Calculate pressure at depth: P = P_atm + ρgh.
    
        Hydrostatic pressure increases with depth.
    
        Args:
            depth: Depth below surface in meters
            fluid_density: Fluid density in kg/m³ (water=1000, seawater=1025)
            atmospheric_pressure: Pressure at surface in Pascals (default 101325)
            gravity: Gravitational acceleration in m/s² (default 9.81)
    
        Returns:
            Dict containing:
                - total_pressure: Total pressure in Pascals
                - gauge_pressure: Pressure above atmospheric in Pascals
                - pressure_atmospheres: Pressure in atmospheres (1 atm = 101325 Pa)
    
        Example - Scuba diving at 30m:
            result = await calculate_pressure_at_depth(
                depth=30,  # meters
                fluid_density=1025,  # seawater
                atmospheric_pressure=101325
            )
            # Result: ~4 atmospheres
        """
        from ..fluid_advanced import (
            PressureAtDepthRequest,
            calculate_pressure_at_depth as calc_pressure,
        )
    
        request = PressureAtDepthRequest(
            depth=depth,
            fluid_density=fluid_density,
            atmospheric_pressure=atmospheric_pressure,
            gravity=gravity,
        )
        response = calc_pressure(request)
        return response.model_dump()
  • Request schema: PressureAtDepthRequest (depth, fluid_density, atmospheric_pressure, gravity) and Response schema: PressureAtDepthResponse (total_pressure, gauge_pressure, pressure_atmospheres)
    class PressureAtDepthRequest(BaseModel):
        """Request for pressure at depth calculation."""
    
        depth: float = Field(..., description="Depth below surface in meters", ge=0.0)
        fluid_density: float = Field(
            default=1000.0, description="Fluid density in kg/m³ (water=1000)", gt=0.0
        )
        atmospheric_pressure: float = Field(
            default=101325.0, description="Atmospheric pressure in Pascals"
        )
        gravity: float = Field(default=9.81, description="Gravitational acceleration in m/s²", gt=0.0)
    
    
    class PressureAtDepthResponse(BaseModel):
        """Response for pressure at depth."""
    
        total_pressure: float = Field(..., description="Total pressure at depth in Pascals")
        gauge_pressure: float = Field(..., description="Gauge pressure (above atmospheric) in Pascals")
        pressure_atmospheres: float = Field(..., description="Pressure in atmospheres (atm)")
  • Registration via @tool decorator on the async function in tools/fluid.py (line 408)
    @tool  # type: ignore[arg-type]
    async def calculate_pressure_at_depth(
        depth: float,
        fluid_density: float,
        atmospheric_pressure: float = 101325.0,
        gravity: float = 9.81,
    ) -> dict:
        """Calculate pressure at depth: P = P_atm + ρgh.
    
        Hydrostatic pressure increases with depth.
    
        Args:
            depth: Depth below surface in meters
            fluid_density: Fluid density in kg/m³ (water=1000, seawater=1025)
            atmospheric_pressure: Pressure at surface in Pascals (default 101325)
            gravity: Gravitational acceleration in m/s² (default 9.81)
    
        Returns:
            Dict containing:
                - total_pressure: Total pressure in Pascals
                - gauge_pressure: Pressure above atmospheric in Pascals
                - pressure_atmospheres: Pressure in atmospheres (1 atm = 101325 Pa)
    
        Example - Scuba diving at 30m:
            result = await calculate_pressure_at_depth(
                depth=30,  # meters
                fluid_density=1025,  # seawater
                atmospheric_pressure=101325
            )
            # Result: ~4 atmospheres
        """
        from ..fluid_advanced import (
            PressureAtDepthRequest,
            calculate_pressure_at_depth as calc_pressure,
        )
    
        request = PressureAtDepthRequest(
            depth=depth,
            fluid_density=fluid_density,
            atmospheric_pressure=atmospheric_pressure,
            gravity=gravity,
        )
        response = calc_pressure(request)
        return response.model_dump()
  • Core calculation function: P_gauge = ρ*g*h, P_total = P_atm + P_gauge, returns PressureAtDepthResponse with total_pressure, gauge_pressure, and pressure_atmospheres
    def calculate_pressure_at_depth(request: PressureAtDepthRequest) -> PressureAtDepthResponse:
        """Calculate pressure at depth: P = P_atm + ρgh.
    
        Args:
            request: Pressure at depth request
    
        Returns:
            Total and gauge pressure
        """
        rho = request.fluid_density
        g = request.gravity
        h = request.depth
        P_atm = request.atmospheric_pressure
    
        # Gauge pressure (pressure due to fluid column)
        P_gauge = rho * g * h
    
        # Total pressure
        P_total = P_atm + P_gauge
    
        # Convert to atmospheres
        P_atmospheres = P_total / 101325.0
    
        return PressureAtDepthResponse(
            total_pressure=P_total,
            gauge_pressure=P_gauge,
            pressure_atmospheres=P_atmospheres,
        )
  • Imports '@tool' decorator from chuk_mcp_server for registering MCP tools
    from chuk_mcp_server import tool
Behavior4/5

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

Annotations are absent, so the description carries full burden. It clearly explains the mathematical relationship and return fields, though it does not disclose edge cases or error handling (e.g., negative depth). The behavior is largely transparent for a simple calculation tool.

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

Conciseness5/5

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

The description is well-structured with formula, args, returns, and an example. Every sentence provides essential information without redundancy. It is front-loaded with the core formula and promptly details parameters.

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 the tool's simplicity, no output schema, and no annotations, the description is complete. It covers all parameters, return fields, and provides a realistic example. The sibling tools are all physics calculations, and this description is adequate for differentiation and usage.

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 no descriptions (0% coverage). The description compensates fully by explaining each parameter, providing typical values, defaults, and a complete example. It adds crucial meaning beyond the schema's raw type definitions.

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 explicitly states 'Calculate pressure at depth' with the formula P = P_atm + ρgh, clearly identifying the tool's purpose. It is distinct from siblings like calculate_buoyancy and calculate_drag_force, which focus on other physical phenomena.

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 provides a concrete scuba diving example, implying usage scenarios, but does not explicitly guide when to use this tool versus related siblings like calculate_buoyancy or calculate_bernoulli. It lacks 'when not to use' or alternative tool recommendations.

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