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.');
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. It implies a mutation ('Add'), but doesn't specify permissions, side effects, error handling, or response format. This is inadequate for a tool that likely modifies system state, as critical behavioral traits are missing.

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 with no wasted words. It's front-loaded and appropriately sized for its content, though this conciseness comes at the cost of detail.

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?

For a mutation tool with no annotations, 2 parameters (one undocumented), and no output schema, the description is incomplete. It lacks essential context like behavioral traits, parameter meanings, and expected outcomes, making it insufficient for reliable agent use.

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 50% (only 'id' has a description), and the description adds no parameter details beyond what the schema provides. It doesn't explain what 'scriptName' represents or how parameters interact, so it fails to compensate for the coverage gap, resulting in a baseline score.

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 'Add a script to a script component' states a clear verb ('Add') and resource ('script to a script component'), but it's vague about what this means operationally. It doesn't distinguish this tool from siblings like 'add_components', 'set_script_text', or 'script_parse', leaving ambiguity about its specific role in the system.

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?

No guidance is provided on when to use this tool versus alternatives. Given siblings like 'add_components', 'set_script_text', and 'script_parse', the description lacks context on prerequisites, exclusions, or comparisons, leaving the agent to infer usage from the tool name alone.

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