Skip to main content
Glama
playcanvas

PlayCanvas Editor MCP Server

Official
by playcanvas

set_material_diffuse

Assign RGB color values to the diffuse property of a material in PlayCanvas Editor by specifying an asset ID and a color array.

Instructions

Set diffuse property on a material

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetIdYesAn asset ID.
colorYesA 3-channel RGB color

Implementation Reference

  • The handler function for the 'set_material_diffuse' MCP tool. It takes assetId and color parameters and calls wss.call to set the 'diffuse' property on the material asset.
    ({ assetId, color }) => { return wss.call('assets:property:set', assetId, 'diffuse', color); }
  • RgbSchema defines the input schema for the 'color' parameter of the set_material_diffuse tool as a tuple of three numbers between 0 and 1.
    export const RgbSchema = z.tuple([ z.number().min(0).max(1).describe('Red'), z.number().min(0).max(1).describe('Green'), z.number().min(0).max(1).describe('Blue') ]).describe('A 3-channel RGB color');
  • AssetIdSchema defines the input schema for the 'assetId' parameter of the set_material_diffuse tool as a nullable integer.
    export const AssetIdSchema = z.number().int().nullable().describe('An asset ID.');
  • The register function that registers the 'set_material_diffuse' tool with the MCP server, including its name, description, input schema, and handler.
    export const register = (mcp: McpServer, wss: WSS) => { mcp.tool( 'set_material_diffuse', 'Set diffuse property on a material', { assetId: AssetIdSchema, color: RgbSchema }, ({ assetId, color }) => { return wss.call('assets:property:set', assetId, 'diffuse', color); } ); };

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/playcanvas/editor-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server