configureVariableAction
Modify variables in Spline 3D scenes to control animations and interactions. Set, increment, decrement, multiply, divide, or toggle values to adjust scene behavior and dynamic elements.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| actionId | Yes | Action ID | |
| variableName | Yes | Variable name | |
| operation | Yes | Operation to perform | |
| value | No | Value to use in the operation |
Implementation Reference
- src/tools/action-tools.js:216-247 (handler)The handler function for the 'configureVariableAction' tool. It updates an existing action to type 'variableControl' with parameters for variable name, operation (set, increment, etc.), and value via a PUT request to the Spline API.
async ({ sceneId, actionId, variableName, operation, value }) => { try { const parameters = { variableName, operation, value, }; await apiClient.request('PUT', `/scenes/${sceneId}/actions/${actionId}`, { type: 'variableControl', parameters }); return { content: [ { type: 'text', text: `Variable control action ${actionId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring variable control action: ${error.message}` } ], isError: true }; } - src/tools/action-tools.js:208-215 (schema)Zod schema defining the input parameters for the 'configureVariableAction' tool: sceneId, actionId, variableName, operation, and value.
{ sceneId: z.string().min(1).describe('Scene ID'), actionId: z.string().min(1).describe('Action ID'), variableName: z.string().min(1).describe('Variable name'), operation: z.enum(['set', 'increment', 'decrement', 'multiply', 'divide', 'toggle']) .describe('Operation to perform'), value: z.any().describe('Value to use in the operation'), }, - src/tools/action-tools.js:207-249 (registration)Registration of the 'configureVariableAction' tool using server.tool() within the registerActionTools function.
'configureVariableAction', { sceneId: z.string().min(1).describe('Scene ID'), actionId: z.string().min(1).describe('Action ID'), variableName: z.string().min(1).describe('Variable name'), operation: z.enum(['set', 'increment', 'decrement', 'multiply', 'divide', 'toggle']) .describe('Operation to perform'), value: z.any().describe('Value to use in the operation'), }, async ({ sceneId, actionId, variableName, operation, value }) => { try { const parameters = { variableName, operation, value, }; await apiClient.request('PUT', `/scenes/${sceneId}/actions/${actionId}`, { type: 'variableControl', parameters }); return { content: [ { type: 'text', text: `Variable control action ${actionId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring variable control action: ${error.message}` } ], isError: true }; } } ); - src/index.js:95-95 (registration)High-level registration call to registerActionTools(server) in the main server setup, which includes the configureVariableAction tool.
registerActionTools(server);