configureSoundAction
Configure sound actions in 3D scenes by setting audio files, volume levels, looping behavior, and spatial positioning for immersive audio experiences.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| actionId | Yes | Action ID | |
| soundUrl | Yes | URL to sound file | |
| volume | No | Volume (0-1) | |
| loop | No | Whether to loop the sound | |
| spatial | No | Whether sound is spatial (3D) | |
| objectId | No | Object ID for spatial sound source |
Implementation Reference
- src/tools/action-tools.js:107-153 (registration)Registration of the 'configureSoundAction' tool on the MCP server, including schema validation and handler function.server.tool( 'configureSoundAction', { sceneId: z.string().min(1).describe('Scene ID'), actionId: z.string().min(1).describe('Action ID'), soundUrl: z.string().url().describe('URL to sound file'), volume: z.number().min(0).max(1).optional().default(1).describe('Volume (0-1)'), loop: z.boolean().optional().default(false).describe('Whether to loop the sound'), spatial: z.boolean().optional().default(false).describe('Whether sound is spatial (3D)'), objectId: z.string().optional().describe('Object ID for spatial sound source'), }, async ({ sceneId, actionId, soundUrl, volume, loop, spatial, objectId }) => { try { const parameters = { soundUrl, volume, loop, spatial, ...(spatial && objectId && { objectId }), }; await apiClient.request('PUT', `/scenes/${sceneId}/actions/${actionId}`, { type: 'sound', parameters }); return { content: [ { type: 'text', text: `Sound action ${actionId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring sound action: ${error.message}` } ], isError: true }; } } );
- src/tools/action-tools.js:118-151 (handler)Executes the configuration of a sound action by updating the action parameters via API call to the Spline server.async ({ sceneId, actionId, soundUrl, volume, loop, spatial, objectId }) => { try { const parameters = { soundUrl, volume, loop, spatial, ...(spatial && objectId && { objectId }), }; await apiClient.request('PUT', `/scenes/${sceneId}/actions/${actionId}`, { type: 'sound', parameters }); return { content: [ { type: 'text', text: `Sound action ${actionId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring sound action: ${error.message}` } ], isError: true }; }
- src/tools/action-tools.js:109-117 (schema)Zod schema for input validation of configureSoundAction parameters.{ sceneId: z.string().min(1).describe('Scene ID'), actionId: z.string().min(1).describe('Action ID'), soundUrl: z.string().url().describe('URL to sound file'), volume: z.number().min(0).max(1).optional().default(1).describe('Volume (0-1)'), loop: z.boolean().optional().default(false).describe('Whether to loop the sound'), spatial: z.boolean().optional().default(false).describe('Whether sound is spatial (3D)'), objectId: z.string().optional().describe('Object ID for spatial sound source'), },
- src/index.js:95-95 (registration)Top-level registration call that invokes registerActionTools on the main MCP server instance, which includes configureSoundAction.registerActionTools(server);