Skip to main content
Glama

createObject

Add 3D objects like cubes, spheres, cylinders, and lights to Spline scenes with custom positioning, rotation, and scaling for 3D design projects.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
typeYesObject type
nameYesObject name
positionNoObject position
rotationNoObject rotation
scaleNoObject scale
colorNoObject color (hex)
propertiesNoAdditional properties

Implementation Reference

  • The MCP tool handler for 'createObject' that constructs the object data from parameters and calls the API client to create the object in the scene, returning success or error response.
    async ({ sceneId, type, name, position, rotation, scale, color, properties }) => { try { const objectData = { type, name, position: position || { x: 0, y: 0, z: 0 }, rotation: rotation || { x: 0, y: 0, z: 0 }, scale: scale || { x: 1, y: 1, z: 1 }, ...(color && { color }), ...(properties && { properties }), }; const result = await apiClient.createObject(sceneId, objectData); return { content: [ { type: 'text', text: `Object created successfully with ID: ${result.id}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error creating object: ${error.message}` } ], isError: true }; }
  • Zod schema defining the input parameters for the createObject tool, including sceneId, type, name, position, rotation, scale, color, and properties.
    { sceneId: z.string().min(1).describe('Scene ID'), type: z.enum([ 'cube', 'sphere', 'cylinder', 'cone', 'torus', 'plane', 'text', 'image', 'group', 'light' ]).describe('Object type'), name: z.string().min(1).describe('Object name'), position: z.object({ x: z.number().default(0).describe('X position'), y: z.number().default(0).describe('Y position'), z: z.number().default(0).describe('Z position'), }).optional().describe('Object position'), rotation: z.object({ x: z.number().default(0).describe('X rotation (degrees)'), y: z.number().default(0).describe('Y rotation (degrees)'), z: z.number().default(0).describe('Z rotation (degrees)'), }).optional().describe('Object rotation'), scale: z.object({ x: z.number().default(1).describe('X scale'), y: z.number().default(1).describe('Y scale'), z: z.number().default(1).describe('Z scale'), }).optional().describe('Object scale'), color: z.string().optional().describe('Object color (hex)'), properties: z.record(z.any()).optional().describe('Additional properties'), },
  • The server.tool call that registers the 'createObject' MCP tool with its schema and handler within the registerObjectTools function.
    server.tool( 'createObject', { sceneId: z.string().min(1).describe('Scene ID'), type: z.enum([ 'cube', 'sphere', 'cylinder', 'cone', 'torus', 'plane', 'text', 'image', 'group', 'light' ]).describe('Object type'), name: z.string().min(1).describe('Object name'), position: z.object({ x: z.number().default(0).describe('X position'), y: z.number().default(0).describe('Y position'), z: z.number().default(0).describe('Z position'), }).optional().describe('Object position'), rotation: z.object({ x: z.number().default(0).describe('X rotation (degrees)'), y: z.number().default(0).describe('Y rotation (degrees)'), z: z.number().default(0).describe('Z rotation (degrees)'), }).optional().describe('Object rotation'), scale: z.object({ x: z.number().default(1).describe('X scale'), y: z.number().default(1).describe('Y scale'), z: z.number().default(1).describe('Z scale'), }).optional().describe('Object scale'), color: z.string().optional().describe('Object color (hex)'), properties: z.record(z.any()).optional().describe('Additional properties'), }, async ({ sceneId, type, name, position, rotation, scale, color, properties }) => { try { const objectData = { type, name, position: position || { x: 0, y: 0, z: 0 }, rotation: rotation || { x: 0, y: 0, z: 0 }, scale: scale || { x: 1, y: 1, z: 1 }, ...(color && { color }), ...(properties && { properties }), }; const result = await apiClient.createObject(sceneId, objectData); return { content: [ { type: 'text', text: `Object created successfully with ID: ${result.id}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error creating object: ${error.message}` } ], isError: true }; } } );
  • src/index.js:88-88 (registration)
    Top-level registration call in the main server setup that invokes registerObjectTools(server), thereby registering the createObject tool.
    registerObjectTools(server);
  • Helper method in the API client that performs the actual HTTP POST request to the Spline.design API to create a new object.
    async createObject(sceneId, objectData) { return this.request('POST', `/scenes/${sceneId}/objects`, objectData); }

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