Skip to main content
Glama
aydinfer
by aydinfer

addPhysicsBody

Add physics properties to 3D objects in Spline scenes to enable realistic movement, collisions, and interactions based on mass, body type, and collision shape.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
objectIdYesObject ID
typeNoPhysics body typedynamic
massNoObject mass
collisionShapeNoCollision shapeauto

Implementation Reference

  • Executes the addition of a physics body to the specified object via the Spline API POST request to /scenes/{sceneId}/objects/{objectId}/physics endpoint.
    async ({ sceneId, objectId, bodyType, shape, mass, parameters }) => {
      try {
        await fetchFromSplineApi(`/scenes/${sceneId}/objects/${objectId}/physics`, {
          method: "POST",
          body: JSON.stringify({
            bodyType,
            shape,
            mass,
            parameters,
          }),
        });
    
        return {
          content: [{
            type: "text",
            text: `Added ${bodyType} physics body to object ${objectId}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error adding physics body: ${error.message}`
          }],
          isError: true
        };
      }
    }
  • Zod schema defining the input parameters for the addPhysicsBody tool, including sceneId, objectId, bodyType, shape, mass, and detailed parameters object.
    {
      sceneId: z.string().min(1).describe("Scene ID"),
      objectId: z.string().min(1).describe("Object ID"),
      bodyType: z.enum(["dynamic", "static", "kinematic"]).describe("Physics body type"),
      shape: z.enum(["auto", "box", "sphere", "capsule", "cylinder", "convex", "mesh"])
        .default("auto").describe("Collision shape type"),
      mass: z.number().min(0).default(1).describe("Mass in kg (0 for static bodies)"),
      parameters: z.object({
        // Friction properties
        friction: z.number().min(0).max(1).default(0.5).describe("Friction coefficient"),
        restitution: z.number().min(0).max(1).default(0.2).describe("Bounciness/restitution"),
        
        // Linear properties
        linearDamping: z.number().min(0).max(1).default(0.01).describe("Linear damping"),
        angularDamping: z.number().min(0).max(1).default(0.01).describe("Angular damping"),
        linearVelocity: z.object({
          x: z.number().default(0),
          y: z.number().default(0),
          z: z.number().default(0),
        }).optional().describe("Initial linear velocity"),
        angularVelocity: z.object({
          x: z.number().default(0),
          y: z.number().default(0),
          z: z.number().default(0),
        }).optional().describe("Initial angular velocity"),
        
        // Collision properties
        collisionGroup: z.number().int().min(0).max(31).default(0).describe("Collision group (0-31)"),
        collidesWith: z.array(z.number().int().min(0).max(31)).optional()
          .describe("Collision groups to collide with (0-31)"),
        isTrigger: z.boolean().default(false).describe("Is this a trigger volume"),
        
        // Constraints
        fixedRotation: z.boolean().default(false).describe("Lock rotation"),
        lockAxisX: z.boolean().default(false).describe("Lock movement along X axis"),
        lockAxisY: z.boolean().default(false).describe("Lock movement along Y axis"),
        lockAxisZ: z.boolean().default(false).describe("Lock movement along Z axis"),
        
        // Advanced properties
        ccdEnabled: z.boolean().default(false).describe("Enable continuous collision detection"),
        sleepThreshold: z.number().positive().default(0.005).describe("Sleep velocity threshold"),
        autoSleep: z.boolean().default(true).describe("Enable automatic sleeping"),
      }).optional().describe("Physics body parameters"),
    },
  • Registers the addPhysicsBody tool on the MCP server with the defined schema and handler.
    server.tool(
      "addPhysicsBody",
      {
        sceneId: z.string().min(1).describe("Scene ID"),
        objectId: z.string().min(1).describe("Object ID"),
        bodyType: z.enum(["dynamic", "static", "kinematic"]).describe("Physics body type"),
        shape: z.enum(["auto", "box", "sphere", "capsule", "cylinder", "convex", "mesh"])
          .default("auto").describe("Collision shape type"),
        mass: z.number().min(0).default(1).describe("Mass in kg (0 for static bodies)"),
        parameters: z.object({
          // Friction properties
          friction: z.number().min(0).max(1).default(0.5).describe("Friction coefficient"),
          restitution: z.number().min(0).max(1).default(0.2).describe("Bounciness/restitution"),
          
          // Linear properties
          linearDamping: z.number().min(0).max(1).default(0.01).describe("Linear damping"),
          angularDamping: z.number().min(0).max(1).default(0.01).describe("Angular damping"),
          linearVelocity: z.object({
            x: z.number().default(0),
            y: z.number().default(0),
            z: z.number().default(0),
          }).optional().describe("Initial linear velocity"),
          angularVelocity: z.object({
            x: z.number().default(0),
            y: z.number().default(0),
            z: z.number().default(0),
          }).optional().describe("Initial angular velocity"),
          
          // Collision properties
          collisionGroup: z.number().int().min(0).max(31).default(0).describe("Collision group (0-31)"),
          collidesWith: z.array(z.number().int().min(0).max(31)).optional()
            .describe("Collision groups to collide with (0-31)"),
          isTrigger: z.boolean().default(false).describe("Is this a trigger volume"),
          
          // Constraints
          fixedRotation: z.boolean().default(false).describe("Lock rotation"),
          lockAxisX: z.boolean().default(false).describe("Lock movement along X axis"),
          lockAxisY: z.boolean().default(false).describe("Lock movement along Y axis"),
          lockAxisZ: z.boolean().default(false).describe("Lock movement along Z axis"),
          
          // Advanced properties
          ccdEnabled: z.boolean().default(false).describe("Enable continuous collision detection"),
          sleepThreshold: z.number().positive().default(0.005).describe("Sleep velocity threshold"),
          autoSleep: z.boolean().default(true).describe("Enable automatic sleeping"),
        }).optional().describe("Physics body parameters"),
      },
      async ({ sceneId, objectId, bodyType, shape, mass, parameters }) => {
        try {
          await fetchFromSplineApi(`/scenes/${sceneId}/objects/${objectId}/physics`, {
            method: "POST",
            body: JSON.stringify({
              bodyType,
              shape,
              mass,
              parameters,
            }),
          });
    
          return {
            content: [{
              type: "text",
              text: `Added ${bodyType} physics body to object ${objectId}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error adding physics body: ${error.message}`
            }],
            isError: true
          };
        }
      }
    );
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/aydinfer/spline-mcp-server'

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