applyMaterial
Assign materials to 3D objects in Spline scenes by specifying scene, object, and material IDs to customize visual appearance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| objectId | Yes | Object ID | |
| materialId | Yes | Material ID |
Implementation Reference
- src/tools/material-tools.js:237-262 (handler)The async handler function for the 'applyMaterial' tool. It sends a POST request to apply the specified materialId to the objectId in the sceneId via the apiClient.async ({ sceneId, objectId, materialId }) => { try { await apiClient.request('POST', `/scenes/${sceneId}/objects/${objectId}/material`, { materialId }); return { content: [ { type: 'text', text: `Material ${materialId} applied to object ${objectId} successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error applying material: ${error.message}` } ], isError: true }; } }
- src/tools/material-tools.js:232-236 (schema)Zod input schema defining parameters for the 'applyMaterial' tool: sceneId, objectId, and materialId.{ sceneId: z.string().min(1).describe('Scene ID'), objectId: z.string().min(1).describe('Object ID'), materialId: z.string().min(1).describe('Material ID'), },
- src/tools/material-tools.js:229-263 (registration)The server.tool registration call for the 'applyMaterial' tool, including schema and handler function.// Apply a material to an object server.tool( 'applyMaterial', { sceneId: z.string().min(1).describe('Scene ID'), objectId: z.string().min(1).describe('Object ID'), materialId: z.string().min(1).describe('Material ID'), }, async ({ sceneId, objectId, materialId }) => { try { await apiClient.request('POST', `/scenes/${sceneId}/objects/${objectId}/material`, { materialId }); return { content: [ { type: 'text', text: `Material ${materialId} applied to object ${objectId} successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error applying material: ${error.message}` } ], isError: true }; } } );