Skip to main content
Glama
playcanvas

PlayCanvas Editor MCP Server

Official
by playcanvas

add_script_component_script

Add a specific script to a script component in PlayCanvas Editor, enabling dynamic 3D web application development by specifying the entity ID and script name.

Instructions

Add a script to a script component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAn entity ID.
scriptNameYes

Implementation Reference

  • Full registration of the MCP tool 'add_script_component_script', including name, description, input schema, and inline handler function.
    mcp.tool(
        'add_script_component_script',
        'Add a script to a script component',
        {
            id: EntityIdSchema,
            scriptName: z.string()
        },
        ({ id, scriptName }) => {
            return wss.call('entities:components:script:add', id, scriptName);
        }
    );
  • The handler lambda that executes the tool logic by calling the WSS endpoint 'entities:components:script:add' with id and scriptName.
    ({ id, scriptName }) => {
        return wss.call('entities:components:script:add', id, scriptName);
    }
  • Input schema for the tool: object with 'id' (EntityIdSchema) and 'scriptName' (string).
    {
        id: EntityIdSchema,
        scriptName: z.string()
    },
  • Shared schema definition for EntityIdSchema, a UUID string, used in the tool's input schema.
    export const EntityIdSchema = z.string().uuid().describe('An entity ID.');

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