Skip to main content
Glama
playcanvas

PlayCanvas Editor MCP Server

Official
by playcanvas

create_assets

Generate CSS, HTML, material, script, shader, template, or text assets for PlayCanvas projects by defining asset type, folder, name, and preload options in JSON format.

Instructions

Create one or more assets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetsYesArray of assets to create.

Implementation Reference

  • The handler function for the 'create_assets' MCP tool. It receives the assets parameter and forwards it to the WebSocket server via wss.call('assets:create', assets). This is the core execution logic of the tool.
    ({ assets }) => {
        return wss.call('assets:create', assets);
    }
  • The registration of the 'create_assets' tool using mcp.tool(). Includes the tool name, description, input schema, and handler function.
        'create_assets',
        'Create one or more assets',
        {
            assets: z.array(
                z.union([
                    CssCreateSchema,
                    FolderCreateSchema,
                    HtmlCreateSchema,
                    MaterialCreateSchema,
                    ScriptCreateSchema,
                    ShaderCreateSchema,
                    TemplateCreateSchema,
                    TextCreateSchema
                ])
            ).nonempty().describe('Array of assets to create.')
        },
        ({ assets }) => {
            return wss.call('assets:create', assets);
        }
    );
  • Input schema definition for the create_assets tool: a non-empty array of union of various asset creation schemas imported from './schema/asset'.
    assets: z.array(
        z.union([
            CssCreateSchema,
            FolderCreateSchema,
            HtmlCreateSchema,
            MaterialCreateSchema,
            ScriptCreateSchema,
            ShaderCreateSchema,
            TemplateCreateSchema,
            TextCreateSchema
        ])
    ).nonempty().describe('Array of assets to create.')
  • Schema definitions for asset creation types (CssCreateSchema, FolderCreateSchema, etc.) used in the create_assets tool's input schema. Imported into asset.ts.
    import { z } from 'zod';
    
    import { AssetIdSchema, EntityIdSchema, RgbSchema, Vec2Schema, Vec3Schema } from './common';
    
    const MaterialSchema = z.object({
        name: z.string().optional(),
        ambient: RgbSchema.optional(),
        aoMap: AssetIdSchema.optional(),
        aoMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        aoMapUv: z.number().int().min(0).max(7).optional(),
        aoMapTiling: Vec2Schema.optional(),
        aoMapOffset: Vec2Schema.optional(),
        aoMapRotation: z.number().optional(),
        aoVertexColor: z.boolean().optional(),
        aoVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        aoIntensity: z.number().optional(),
        diffuse: RgbSchema.optional(),
        diffuseMap: AssetIdSchema.optional(),
        diffuseMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        diffuseMapUv: z.number().int().min(0).max(7).optional(),
        diffuseMapTiling: Vec2Schema.optional(),
        diffuseMapOffset: Vec2Schema.optional(),
        diffuseMapRotation: z.number().optional(),
        diffuseVertexColor: z.boolean().optional(),
        diffuseVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        specular: RgbSchema.optional(),
        specularMap: AssetIdSchema.optional(),
        specularMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        specularMapUv: z.number().int().min(0).max(7).optional(),
        specularMapTiling: Vec2Schema.optional(),
        specularMapOffset: Vec2Schema.optional(),
        specularMapRotation: z.number().optional(),
        specularAntialias: z.boolean().optional(),
        specularTint: z.boolean().optional(),
        specularVertexColor: z.boolean().optional(),
        specularVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        occludeSpecular: z.number().int().min(0).max(2).optional(),
        specularityFactor: z.number().optional(),
        specularityFactorMap: AssetIdSchema.optional(),
        specularityFactorMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        specularityFactorMapUv: z.number().int().min(0).max(7).optional(),
        specularityFactorMapTiling: Vec2Schema.optional(),
        specularityFactorMapOffset: Vec2Schema.optional(),
        specularityFactorMapRotation: z.number().optional(),
        specularityFactorTint: z.boolean().optional(),
        specularityFactorVertexColor: z.boolean().optional(),
        specularityFactorVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        enableGGXSpecular: z.boolean().optional(),
        anisotropy: z.number().min(-1).max(1).optional(),
        useMetalness: z.boolean().optional(),
        metalness: z.number().min(0).max(1).optional(),
        metalnessMap: AssetIdSchema.optional(),
        metalnessMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        metalnessMapUv: z.number().int().min(0).max(7).optional(),
        metalnessMapTiling: Vec2Schema.optional(),
        metalnessMapOffset: Vec2Schema.optional(),
        metalnessMapRotation: z.number().optional(),
        metalnessVertexColor: z.boolean().optional(),
        metalnessVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        useMetalnessSpecularColor: z.boolean().optional(),
        conserveEnergy: z.boolean().optional(),
        shininess: z.number().min(0).max(100).optional(),
        glossMap: AssetIdSchema.optional(),
        glossMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        glossMapUv: z.number().int().min(0).max(7).optional(),
        glossMapTiling: Vec2Schema.optional(),
        glossMapOffset: Vec2Schema.optional(),
        glossMapRotation: z.number().optional(),
        glossVertexColor: z.boolean().optional(),
        glossVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        glossInvert: z.boolean().optional(),
        clearCoat: z.number().min(0).max(1).optional(),
        clearCoatMap: AssetIdSchema.optional(),
        clearCoatMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        clearCoatMapUv: z.number().int().min(0).max(7).optional(),
        clearCoatMapTiling: Vec2Schema.optional(),
        clearCoatMapOffset: Vec2Schema.optional(),
        clearCoatMapRotation: z.number().optional(),
        clearCoatVertexColor: z.boolean().optional(),
        clearCoatVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        clearCoatGloss: z.number().min(0).max(1).optional(),
        clearCoatGlossMap: AssetIdSchema.optional(),
        clearCoatGlossMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        clearCoatGlossMapUv: z.number().int().min(0).max(7).optional(),
        clearCoatGlossMapTiling: Vec2Schema.optional(),
        clearCoatGlossMapOffset: Vec2Schema.optional(),
        clearCoatGlossMapRotation: z.number().optional(),
        clearCoatGlossVertexColor: z.boolean().optional(),
        clearCoatGlossVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        clearCoatGlossInvert: z.boolean().optional(),
        clearCoatNormalMap: AssetIdSchema.optional(),
        clearCoatNormalMapUv: z.number().int().min(0).max(7).optional(),
        clearCoatNormalMapTiling: Vec2Schema.optional(),
        clearCoatNormalMapOffset: Vec2Schema.optional(),
        clearCoatNormalMapRotation: z.number().optional(),
        useSheen: z.boolean().optional(),
        sheen: RgbSchema.optional(),
        sheenMap: AssetIdSchema.optional(),
        sheenMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        sheenMapUv: z.number().int().min(0).max(7).optional(),
        sheenMapTiling: Vec2Schema.optional(),
        sheenMapOffset: Vec2Schema.optional(),
        sheenMapRotation: z.number().optional(),
        sheenVertexColor: z.boolean().optional(),
        sheenVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        sheenGloss: z.number().optional(),
        sheenGlossMap: AssetIdSchema.optional(),
        sheenGlossMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        sheenGlossMapUv: z.number().int().min(0).max(7).optional(),
        sheenGlossMapTiling: Vec2Schema.optional(),
        sheenGlossMapOffset: Vec2Schema.optional(),
        sheenGlossMapRotation: z.number().optional(),
        sheenGlossVertexColor: z.boolean().optional(),
        sheenGlossVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        sheenGlossInvert: z.boolean().optional(),
        emissive: RgbSchema.optional(),
        emissiveMap: AssetIdSchema.optional(),
        emissiveMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        emissiveMapUv: z.number().int().min(0).max(7).optional(),
        emissiveMapTiling: Vec2Schema.optional(),
        emissiveMapOffset: Vec2Schema.optional(),
        emissiveMapRotation: z.number().optional(),
        emissiveIntensity: z.number().min(0).max(10).optional(),
        emissiveVertexColor: z.boolean().optional(),
        emissiveVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        normalMap: AssetIdSchema.optional(),
        normalMapUv: z.number().int().min(0).max(7).optional(),
        normalMapTiling: Vec2Schema.optional(),
        normalMapOffset: Vec2Schema.optional(),
        normalMapRotation: z.number().optional(),
        bumpMapFactor: z.number().optional(),
        useDynamicRefraction: z.boolean().optional(),
        refraction: z.number().min(0).max(1).optional(),
        refractionMap: AssetIdSchema.optional(),
        refractionMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        refractionMapUv: z.number().int().min(0).max(7).optional(),
        refractionMapTiling: Vec2Schema.optional(),
        refractionMapOffset: Vec2Schema.optional(),
        refractionMapRotation: z.number().optional(),
        refractionVertexColor: z.boolean().optional(),
        refractionVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        refractionIndex: z.number().min(0).max(1).optional(),
        dispersion: z.number().min(0).max(10).optional(),
        thickness: z.number().optional(),
        thicknessMap: AssetIdSchema.optional(),
        thicknessMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        thicknessMapUv: z.number().int().min(0).max(7).optional(),
        thicknessMapTiling: Vec2Schema.optional(),
        thicknessMapOffset: Vec2Schema.optional(),
        thicknessMapRotation: z.number().optional(),
        thicknessVertexColor: z.boolean().optional(),
        thicknessVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        attenuation: z.array(z.number()).length(3).optional(),
        attenuationDistance: z.number().optional(),
        useIridescence: z.boolean().optional(),
        iridescence: z.number().optional(),
        iridescenceMap: AssetIdSchema.optional(),
        iridescenceMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        iridescenceMapUv: z.number().int().min(0).max(7).optional(),
        iridescenceMapTiling: Vec2Schema.optional(),
        iridescenceMapOffset: Vec2Schema.optional(),
        iridescenceMapRotation: z.number().optional(),
        iridescenceRefractionIndex: z.number().optional(),
        iridescenceThicknessMap: AssetIdSchema.optional(),
        iridescenceThicknessMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        iridescenceThicknessMapUv: z.number().int().min(0).max(7).optional(),
        iridescenceThicknessMapTiling: Vec2Schema.optional(),
        iridescenceThicknessMapOffset: Vec2Schema.optional(),
        iridescenceThicknessMapRotation: z.number().optional(),
        iridescenceThicknessMin: z.number().optional(),
        iridescenceThicknessMax: z.number().optional(),
        heightMap: AssetIdSchema.optional(),
        heightMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        heightMapUv: z.number().int().min(0).max(7).optional(),
        heightMapTiling: Vec2Schema.optional(),
        heightMapOffset: Vec2Schema.optional(),
        heightMapRotation: z.number().optional(),
        heightMapFactor: z.number().min(0).max(2).optional(),
        alphaToCoverage: z.boolean().optional(),
        alphaTest: z.number().min(0).max(1).optional(),
        alphaFade: z.number().min(0).max(1).optional(),
        opacity: z.number().min(0).max(1).optional(),
        opacityMap: AssetIdSchema.optional(),
        opacityMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        opacityMapUv: z.number().int().min(0).max(7).optional(),
        opacityMapTiling: Vec2Schema.optional(),
        opacityMapOffset: Vec2Schema.optional(),
        opacityMapRotation: z.number().optional(),
        opacityVertexColor: z.boolean().optional(),
        opacityVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        opacityFadesSpecular: z.boolean().optional(),
        opacityDither: z.enum(['none', 'bayer8', 'bluenoise', 'ignnoise']).optional(),
        opacityShadowDither: z.enum(['none', 'bayer8', 'bluenoise', 'ignnoise']).optional(),
        reflectivity: z.number().min(0).max(1).optional(),
        sphereMap: AssetIdSchema.optional(),
        cubeMap: AssetIdSchema.optional(),
        cubeMapProjection: z.number().int().min(0).max(1).optional(),
        cubeMapProjectionBox: z.object({
            center: Vec3Schema,
            halfExtents: Vec3Schema
        }).optional(),
        lightMap: AssetIdSchema.optional(),
        lightMapChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        lightMapUv: z.number().int().min(0).max(7).optional(),
        lightMapTiling: Vec2Schema.optional(),
        lightMapOffset: Vec2Schema.optional(),
        lightMapRotation: z.number().optional(),
        lightVertexColor: z.boolean().optional(),
        lightVertexColorChannel: z.enum(['r', 'g', 'b', 'a', 'rgb']).optional(),
        depthTest: z.boolean().optional(),
        depthWrite: z.boolean().optional(),
        depthBias: z.number().optional(),
        slopeDepthBias: z.number().optional(),
        cull: z.number().int().min(0).max(3).optional(),
        blendType: z.number().int().min(0).max(10).optional(),
        useFog: z.boolean().optional(),
        useLighting: z.boolean().optional(),
        useSkybox: z.boolean().optional(),
        useTonemap: z.boolean().optional(),
        twoSidedLighting: z.boolean().optional()
    });
    
    export const CssCreateSchema = z.object({
        type: z.literal('css'),
        options: z.object({
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional(),
            text: z.string().optional()
        }).optional()
    }).describe('CSS asset creation options.');
    
    export const HtmlCreateSchema = z.object({
        type: z.literal('html'),
        options: z.object({
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional(),
            text: z.string().optional()
        }).optional()
    }).describe('HTML asset creation options.');
    
    export const FolderCreateSchema = z.object({
        type: z.literal('folder'),
        options: z.object({
            folder: AssetIdSchema.optional(),
            name: z.string().optional()
        }).optional()
    }).describe('Folder asset creation options.');
    
    export const MaterialCreateSchema = z.object({
        type: z.literal('material'),
        options: z.object({
            data: MaterialSchema.optional(),
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional()
        }).optional()
    }).describe('Material asset creation options.');
    
    export const ScriptCreateSchema = z.object({
        type: z.literal('script'),
        options: z.object({
            filename: z.string().optional(),
            folder: AssetIdSchema.optional(),
            preload: z.boolean().optional(),
            text: z.string().optional()
        }).optional()
    }).describe('Script asset creation options.');
    
    export const ShaderCreateSchema = z.object({
        type: z.literal('shader'),
        options: z.object({
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional(),
            text: z.string().optional()
        }).optional()
    }).describe('Shader asset creation options.');
    
    export const TemplateCreateSchema = z.object({
        type: z.literal('template'),
        options: z.object({
            entity: EntityIdSchema,
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional()
        })
    }).describe('Template asset creation options.');
    
    export const TextCreateSchema = z.object({
        type: z.literal('text'),
        options: z.object({
            folder: AssetIdSchema.optional(),
            name: z.string().optional(),
            preload: z.boolean().optional(),
            text: z.string().optional()
        }).optional()
    }).describe('Text asset creation options.');
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Create' implies a mutation operation, but the description doesn't state whether this requires specific permissions, what happens on failure (e.g., partial creation), if it's idempotent, or what the response looks like. For a complex creation tool with multiple asset types, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Create one or more assets'. It's front-loaded with the core action and resource, with zero wasted words. This is appropriately concise for a tool where detailed parameter semantics are covered in the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (multiple asset types with nested schemas), no annotations, and no output schema, the description is incomplete. It doesn't explain the return values, error handling, or behavioral nuances like whether assets are created synchronously/asynchronously. For a creation tool with such rich input structure, more context is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with detailed descriptions for all nested parameters (e.g., 'Array of assets to create' for the main parameter). The description adds no additional parameter information beyond what's in the schema. According to the rules, with high schema coverage (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create one or more assets' states the verb (create) and resource (assets), making the basic purpose clear. However, it's vague about what types of assets can be created (CSS, folder, HTML, material, script, shader, template, text) and doesn't distinguish from sibling tools like 'instantiate_template_assets' or 'list_assets'. It's adequate but lacks specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, when to choose this over sibling tools like 'instantiate_template_assets' (for templates) or 'add_components' (for components), or any context for asset creation. This leaves the agent without usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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