Skip to main content
Glama

updateMaterial

Modify material properties in 3D scenes including color, roughness, metalness, opacity, and shading parameters to customize visual appearance and surface characteristics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
materialIdYesMaterial ID
colorNoBase color (hex)
roughnessNoSurface roughness (0-1)
metalnessNoMetalness factor (0-1)
opacityNoOpacity (0-1)
transparentNoWhether the material is transparent
wireframeNoWhether to render as wireframe
emissiveNoEmissive color (hex)
emissiveIntensityNoIntensity of emission
sideNoWhich side to render
flatShadingNoUse flat shading
propertiesNoAdditional properties

Implementation Reference

  • The MCP tool handler for 'updateMaterial' that processes inputs, builds update payload, invokes the API client, and returns formatted response.
    async ({ sceneId, materialId, color, roughness, metalness, opacity, transparent, wireframe, emissive, emissiveIntensity, side, flatShading, properties }) => { try { const updateData = { ...(color && { color }), ...(roughness !== undefined && { roughness }), ...(metalness !== undefined && { metalness }), ...(opacity !== undefined && { opacity }), ...(transparent !== undefined && { transparent }), ...(wireframe !== undefined && { wireframe }), ...(emissive && { emissive }), ...(emissiveIntensity !== undefined && { emissiveIntensity }), ...(side && { side }), ...(flatShading !== undefined && { flatShading }), ...(properties && { properties }), }; await apiClient.updateMaterial(sceneId, materialId, updateData); return { content: [ { type: 'text', text: `Material ${materialId} updated successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error updating material: ${error.message}` } ], isError: true }; } }
  • Zod input schema for the 'updateMaterial' tool parameters.
    { sceneId: z.string().min(1).describe('Scene ID'), materialId: z.string().min(1).describe('Material ID'), color: z.string().optional().describe('Base color (hex)'), roughness: z.number().min(0).max(1).optional().describe('Surface roughness (0-1)'), metalness: z.number().min(0).max(1).optional().describe('Metalness factor (0-1)'), opacity: z.number().min(0).max(1).optional().describe('Opacity (0-1)'), transparent: z.boolean().optional().describe('Whether the material is transparent'), wireframe: z.boolean().optional().describe('Whether to render as wireframe'), emissive: z.string().optional().describe('Emissive color (hex)'), emissiveIntensity: z.number().min(0).optional().describe('Intensity of emission'), side: z.enum(['front', 'back', 'double']).optional().describe('Which side to render'), flatShading: z.boolean().optional().describe('Use flat shading'), properties: z.record(z.any()).optional().describe('Additional properties'), },
  • MCP server registration of the 'updateMaterial' tool using server.tool(name, inputSchema, handlerFn).
    server.tool( 'updateMaterial', { sceneId: z.string().min(1).describe('Scene ID'), materialId: z.string().min(1).describe('Material ID'), color: z.string().optional().describe('Base color (hex)'), roughness: z.number().min(0).max(1).optional().describe('Surface roughness (0-1)'), metalness: z.number().min(0).max(1).optional().describe('Metalness factor (0-1)'), opacity: z.number().min(0).max(1).optional().describe('Opacity (0-1)'), transparent: z.boolean().optional().describe('Whether the material is transparent'), wireframe: z.boolean().optional().describe('Whether to render as wireframe'), emissive: z.string().optional().describe('Emissive color (hex)'), emissiveIntensity: z.number().min(0).optional().describe('Intensity of emission'), side: z.enum(['front', 'back', 'double']).optional().describe('Which side to render'), flatShading: z.boolean().optional().describe('Use flat shading'), properties: z.record(z.any()).optional().describe('Additional properties'), }, async ({ sceneId, materialId, color, roughness, metalness, opacity, transparent, wireframe, emissive, emissiveIntensity, side, flatShading, properties }) => { try { const updateData = { ...(color && { color }), ...(roughness !== undefined && { roughness }), ...(metalness !== undefined && { metalness }), ...(opacity !== undefined && { opacity }), ...(transparent !== undefined && { transparent }), ...(wireframe !== undefined && { wireframe }), ...(emissive && { emissive }), ...(emissiveIntensity !== undefined && { emissiveIntensity }), ...(side && { side }), ...(flatShading !== undefined && { flatShading }), ...(properties && { properties }), }; await apiClient.updateMaterial(sceneId, materialId, updateData); return { content: [ { type: 'text', text: `Material ${materialId} updated successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error updating material: ${error.message}` } ], isError: true }; } } );
  • Helper method in API client that sends PUT request to update material properties in the Spline API.
    async updateMaterial(sceneId, materialId, properties) { return this.request('PUT', `/scenes/${sceneId}/materials/${materialId}`, properties); }
  • src/index.js:89-89 (registration)
    Invocation of registerMaterialTools which includes registration of 'updateMaterial' tool.
    registerMaterialTools(server);

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