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
| Name | Required | Description | Default |
|---|---|---|---|
| assetId | Yes | An asset ID. | |
| color | Yes | A 3-channel RGB color |
Implementation Reference
- src/tools/assets/material.ts:14-16 (handler)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); }
- src/tools/schema/common.ts:3-7 (schema)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');
- src/tools/schema/common.ts:34-34 (schema)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.');
- src/tools/assets/material.ts:6-18 (registration)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); } ); };