Skip to main content
Glama
aydinfer
by aydinfer

listMaterialLayers

Retrieve all layers associated with a specific material in a 3D scene to analyze material composition and layer structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
materialIdYesMaterial ID

Implementation Reference

  • The handler function retrieves the list of material layers for a given scene and material ID via an API GET request and returns the JSON stringified layers or an error message.
    async ({ sceneId, materialId }) => {
      try {
        const layers = await apiClient.request('GET', `/scenes/${sceneId}/materials/${materialId}/layers`);
        
        return {
          content: [
            { 
              type: 'text', 
              text: JSON.stringify(layers, null, 2) 
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            { 
              type: 'text', 
              text: `Error listing material layers: ${error.message}` 
            }
          ],
          isError: true
        };
      }
    }
  • Zod schema for validating the input parameters: sceneId and materialId as non-empty strings.
    {
      sceneId: z.string().min(1).describe('Scene ID'),
      materialId: z.string().min(1).describe('Material ID'),
    },
  • Registration of the 'listMaterialLayers' tool using server.tool method within the registerAdvancedMaterialTools function.
      'listMaterialLayers',
      {
        sceneId: z.string().min(1).describe('Scene ID'),
        materialId: z.string().min(1).describe('Material ID'),
      },
      async ({ sceneId, materialId }) => {
        try {
          const layers = await apiClient.request('GET', `/scenes/${sceneId}/materials/${materialId}/layers`);
          
          return {
            content: [
              { 
                type: 'text', 
                text: JSON.stringify(layers, null, 2) 
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              { 
                type: 'text', 
                text: `Error listing material layers: ${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