Skip to main content
Glama

createAction

Add interactive actions to Spline 3D scenes by creating transitions, animations, sound effects, camera controls, and object behaviors triggered by events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
eventIdYesEvent ID to attach this action to
typeYesAction type
nameYesAction name
targetNoTarget ID (object, state, camera, etc.)
parametersNoAction parameters

Implementation Reference

  • The main handler function that executes the createAction tool by constructing action data and sending a POST request to the Spline API endpoint to create a new action attached to the specified event.
    async ({ sceneId, eventId, type, name, target, parameters }) => { try { const actionData = { type, name, ...(target && { target }), ...(parameters && { parameters }), }; const result = await apiClient.request('POST', `/scenes/${sceneId}/events/${eventId}/actions`, actionData); return { content: [ { type: 'text', text: `Action "${name}" created successfully with ID: ${result.id}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error creating action: ${error.message}` } ], isError: true }; } }
  • Zod schema defining the input parameters and validation for the createAction tool.
    { sceneId: z.string().min(1).describe('Scene ID'), eventId: z.string().min(1).describe('Event ID to attach this action to'), type: z.enum([ 'transition', 'sound', 'video', 'openLink', 'resetScene', 'switchCamera', 'createObject', 'destroyObject', 'sceneTransition', 'animation', 'particlesControl', 'variableControl', 'conditional', 'setVariable', 'clearLocalStorage', 'apiRequest' ]).describe('Action type'), name: z.string().min(1).describe('Action name'), target: z.string().optional().describe('Target ID (object, state, camera, etc.)'), parameters: z.record(z.any()).optional().describe('Action parameters'), },
  • The server.tool call that registers the createAction tool with its schema and handler within the registerActionTools function.
    server.tool( 'createAction', { sceneId: z.string().min(1).describe('Scene ID'), eventId: z.string().min(1).describe('Event ID to attach this action to'), type: z.enum([ 'transition', 'sound', 'video', 'openLink', 'resetScene', 'switchCamera', 'createObject', 'destroyObject', 'sceneTransition', 'animation', 'particlesControl', 'variableControl', 'conditional', 'setVariable', 'clearLocalStorage', 'apiRequest' ]).describe('Action type'), name: z.string().min(1).describe('Action name'), target: z.string().optional().describe('Target ID (object, state, camera, etc.)'), parameters: z.record(z.any()).optional().describe('Action parameters'), }, async ({ sceneId, eventId, type, name, target, parameters }) => { try { const actionData = { type, name, ...(target && { target }), ...(parameters && { parameters }), }; const result = await apiClient.request('POST', `/scenes/${sceneId}/events/${eventId}/actions`, actionData); return { content: [ { type: 'text', text: `Action "${name}" created successfully with ID: ${result.id}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error creating action: ${error.message}` } ], isError: true }; } } );
  • src/index.js:95-95 (registration)
    The call to registerActionTools(server) in the main server setup, which includes registering the createAction tool.
    registerActionTools(server);

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