triggerState
Activate specific animation states in 3D scenes to control transitions and visual effects within the Spline design environment.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| stateId | Yes | State ID |
Implementation Reference
- src/tools/state-event-tools.js:128-151 (handler)The main execution logic for the 'triggerState' tool. Calls the apiClient helper and formats MCP response.async ({ sceneId, stateId }) => { try { await apiClient.triggerState(sceneId, stateId); return { content: [ { type: 'text', text: `State ${stateId} triggered successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error triggering state: ${error.message}` } ], isError: true }; } }
- Zod input schema defining required sceneId and stateId parameters with validation and descriptions.{ sceneId: z.string().min(1).describe('Scene ID'), stateId: z.string().min(1).describe('State ID'), },
- src/tools/state-event-tools.js:122-152 (registration)Direct registration of the 'triggerState' tool using server.tool(), including schema and handler.server.tool( 'triggerState', { sceneId: z.string().min(1).describe('Scene ID'), stateId: z.string().min(1).describe('State ID'), }, async ({ sceneId, stateId }) => { try { await apiClient.triggerState(sceneId, stateId); return { content: [ { type: 'text', text: `State ${stateId} triggered successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error triggering state: ${error.message}` } ], isError: true }; } } );
- src/utils/api-client.js:163-165 (helper)API client helper method that sends POST request to Spline API to trigger the specified state.async triggerState(sceneId, stateId) { return this.request('POST', `/scenes/${sceneId}/states/${stateId}/trigger`); }
- src/index.js:90-90 (registration)Top-level call to registerStateEventTools(server) which includes the triggerState tool registration.registerStateEventTools(server);