getVariable
Retrieve specific variable values from Spline 3D scenes to access and use scene data in your design workflow.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| variableName | Yes | Variable name |
Implementation Reference
- src/tools/scene-tools.js:159-194 (handler)The handler function for the 'getVariable' tool. It fetches all variables from the scene via the API, finds the one matching the variableName, and returns its details as JSON or an error if not found.async ({ sceneId, variableName }) => { try { const variables = await apiClient.request('GET', `/scenes/${sceneId}/variables`); const variable = variables.find(v => v.name === variableName); if (!variable) { return { content: [ { type: 'text', text: `Variable "${variableName}" not found` } ], isError: true }; } return { content: [ { type: 'text', text: JSON.stringify(variable, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving variable: ${error.message}` } ], isError: true }; }
- src/tools/scene-tools.js:155-158 (schema)Zod schema defining the input parameters for the 'getVariable' tool: sceneId (string) and variableName (string).{ sceneId: z.string().min(1).describe('Scene ID'), variableName: z.string().min(1).describe('Variable name'), },
- src/tools/scene-tools.js:153-196 (registration)Registration of the 'getVariable' MCP tool using server.tool(), including schema and inline handler.server.tool( 'getVariable', { sceneId: z.string().min(1).describe('Scene ID'), variableName: z.string().min(1).describe('Variable name'), }, async ({ sceneId, variableName }) => { try { const variables = await apiClient.request('GET', `/scenes/${sceneId}/variables`); const variable = variables.find(v => v.name === variableName); if (!variable) { return { content: [ { type: 'text', text: `Variable "${variableName}" not found` } ], isError: true }; } return { content: [ { type: 'text', text: JSON.stringify(variable, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving variable: ${error.message}` } ], isError: true }; } } );