Skip to main content
Glama

configureGradientLayer

Configure gradient layers in 3D scenes by setting gradient types, colors, positions, rotation, and scale for materials in Spline designs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
materialIdYesMaterial ID
layerIdYesLayer ID
gradientTypeYesGradient type
colorsYesGradient colors
rotationNoRotation in degrees
scaleNoGradient scale

Implementation Reference

  • The handler function for the 'configureGradientLayer' tool. It constructs layer parameters from inputs and sends a PUT request to the API endpoint to update the gradient layer on the specified material.
    async ({ sceneId, materialId, layerId, gradientType, colors, rotation, scale }) => { try { const layerParams = { gradientType, colors, ...(rotation !== undefined && { rotation }), ...(scale !== undefined && { scale }), }; await apiClient.request('PUT', `/scenes/${sceneId}/materials/${materialId}/layers/${layerId}`, { params: layerParams }); return { content: [ { type: 'text', text: `Gradient layer ${layerId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring gradient layer: ${error.message}` } ], isError: true }; } }
  • Zod input schema for the 'configureGradientLayer' tool, validating parameters like sceneId, materialId, layerId, gradientType, colors array, rotation, and scale.
    { sceneId: z.string().min(1).describe('Scene ID'), materialId: z.string().min(1).describe('Material ID'), layerId: z.string().min(1).describe('Layer ID'), gradientType: z.enum(['linear', 'radial', 'angular']).describe('Gradient type'), colors: z.array(z.object({ color: z.string().describe('Color value (hex, rgb, or rgba)'), position: z.number().min(0).max(1).describe('Position in gradient (0-1)'), })).min(2).describe('Gradient colors'), rotation: z.number().optional().default(0).describe('Rotation in degrees'), scale: z.number().optional().default(1).describe('Gradient scale'), },
  • Registration of the 'configureGradientLayer' tool via server.tool() within the registerAdvancedMaterialTools function.
    'configureGradientLayer', { sceneId: z.string().min(1).describe('Scene ID'), materialId: z.string().min(1).describe('Material ID'), layerId: z.string().min(1).describe('Layer ID'), gradientType: z.enum(['linear', 'radial', 'angular']).describe('Gradient type'), colors: z.array(z.object({ color: z.string().describe('Color value (hex, rgb, or rgba)'), position: z.number().min(0).max(1).describe('Position in gradient (0-1)'), })).min(2).describe('Gradient colors'), rotation: z.number().optional().default(0).describe('Rotation in degrees'), scale: z.number().optional().default(1).describe('Gradient scale'), }, async ({ sceneId, materialId, layerId, gradientType, colors, rotation, scale }) => { try { const layerParams = { gradientType, colors, ...(rotation !== undefined && { rotation }), ...(scale !== undefined && { scale }), }; await apiClient.request('PUT', `/scenes/${sceneId}/materials/${materialId}/layers/${layerId}`, { params: layerParams }); return { content: [ { type: 'text', text: `Gradient layer ${layerId} configured successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error configuring gradient layer: ${error.message}` } ], isError: true }; } } );

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