Skip to main content
Glama

setVariable

Set and modify variables in Spline 3D scenes to control animations, object properties, and interactive behaviors through parameter adjustments.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
variableNameYesVariable name
valueNoVariable value
variableTypeYesVariable type

Implementation Reference

  • The handler function that implements the 'setVariable' tool. It takes sceneId, variableName, value, and variableType, converts the value to the appropriate type, and updates the variable via the Spline API.
    server.tool( 'setVariable', { sceneId: z.string().min(1).describe('Scene ID'), variableName: z.string().min(1).describe('Variable name'), value: z.any().describe('Variable value'), variableType: z.enum(['string', 'number', 'boolean']).describe('Variable type'), }, async ({ sceneId, variableName, value, variableType }) => { try { // Convert value based on specified type let typedValue = value; if (variableType === 'number') { typedValue = Number(value); } else if (variableType === 'boolean') { typedValue = Boolean(value); } else { typedValue = String(value); } await apiClient.request('PUT', `/scenes/${sceneId}/variables/${variableName}`, { value: typedValue, type: variableType }); return { content: [ { type: 'text', text: `Variable "${variableName}" set to ${JSON.stringify(typedValue)}` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error setting variable: ${error.message}` } ], isError: true }; } } );
  • The Zod input schema for the setVariable tool parameters.
    sceneId: z.string().min(1).describe('Scene ID'), variableName: z.string().min(1).describe('Variable name'), value: z.any().describe('Variable value'), variableType: z.enum(['string', 'number', 'boolean']).describe('Variable type'), },
  • src/index.js:92-92 (registration)
    Registration of the scene tools module, which includes the setVariable tool, on the MCP server.
    registerSceneTools(server);
  • src/index.js:19-19 (registration)
    Import of the scene-tools module containing the setVariable tool.
    import { registerSceneTools } from './tools/scene-tools.js';

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