getMaterials
Retrieve material data from a Spline 3D scene using the scene ID to access and work with design elements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID |
Implementation Reference
- src/tools/material-tools.js:15-37 (handler)The handler function for the 'getMaterials' MCP tool. It fetches materials from the scene using apiClient.getMaterials(sceneId), stringifies them as JSON, and returns in MCP content format or an error message.async ({ sceneId }) => { try { const materials = await apiClient.getMaterials(sceneId); return { content: [ { type: 'text', text: JSON.stringify(materials, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving materials: ${error.message}` } ], isError: true }; } }
- src/tools/material-tools.js:12-14 (schema)Input schema for the getMaterials tool, validating sceneId as a non-empty string.{ sceneId: z.string().min(1).describe('Scene ID'), },
- src/tools/material-tools.js:10-38 (registration)Registration of the 'getMaterials' tool on the MCP server within registerMaterialTools.server.tool( 'getMaterials', { sceneId: z.string().min(1).describe('Scene ID'), }, async ({ sceneId }) => { try { const materials = await apiClient.getMaterials(sceneId); return { content: [ { type: 'text', text: JSON.stringify(materials, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving materials: ${error.message}` } ], isError: true }; } } );
- src/index.js:89-89 (registration)Top-level call to registerMaterialTools which includes the getMaterials tool registration.registerMaterialTools(server);
- src/utils/api-client.js:123-125 (helper)Supporting API client method that performs the actual HTTP GET request to retrieve materials from the Spline API.async getMaterials(sceneId) { return this.request('GET', `/scenes/${sceneId}/materials`); }