Skip to main content
Glama
IBM

Physics MCP Server

by IBM

record_trajectory

Steps a physics simulation and records the position, orientation, and velocity of a specific body at each timestep. Use the output frames to animate objects in React Three Fiber.

Instructions

Record the trajectory of a specific body over time.

Steps the simulation and records position/orientation/velocity at each
timestep for one body. Perfect for generating animation data for R3F.

Args:
    sim_id: Simulation ID
    body_id: ID of the body to track
    steps: Number of timesteps to record
    dt: Optional timestep override. If None, uses config default.

Returns:
    TrajectoryResponse containing:
        - body_id: Tracked body identifier
        - frames: List of trajectory frames with time, position, orientation, velocity
        - total_time: Total simulated time in seconds
        - num_frames: Number of frames recorded

Tips for LLMs:
    - Each frame has: time, position [x,y,z], orientation [x,y,z,w], velocity [x,y,z]
    - Frames are evenly spaced in time (every dt seconds)
    - Output is R3F-compatible: use position/orientation directly in Three.js
    - For 60 FPS video: record at dt=1/60 ≈ 0.0167
    - Typical recording: 100-1000 frames (1.6-16 seconds at 60 FPS)

Example:
    # Record 5 seconds of a falling ball
    traj = await record_trajectory(
        sim_id=sim_id,
        body_id="ball",
        steps=300  # 300 × 0.016 ≈ 5 seconds
    )
    # Use traj.frames in React Three Fiber for animation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sim_idYes
body_idYes
stepsYes
dtNo
Behavior4/5

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

Discloses that the simulation is stepped, records per timestep, and describes return frame structure. Without annotations, it carries the full burden and covers key behaviors, though could mention simulation state mutability more explicitly.

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?

Well-organized with sections for description, args, returns, tips, and example. Every sentence adds value; no redundancy.

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?

Covers return format comprehensively given no output schema. Mentions prerequisites indirectly (sim_id, body_id) but does not address error conditions or missing bodies.

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?

Fully explains all 4 parameters including purpose, optionality (dt), and typical values. Compensates for 0% schema coverage with clear descriptions and an example.

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?

Clearly states verb (record), resource (trajectory of a specific body), and scope (over time). Differentiates from siblings like record_trajectory_with_events by focusing on pure trajectory recording without events.

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?

Provides practical context: generating animation data for R3F, tips for FPS, and example usage. However, does not explicitly mention when not to use or compare to sibling alternatives.

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