Skip to main content
Glama
playcanvas

PlayCanvas Editor MCP Server

Official
by playcanvas

script_parse

Parse scripts after modification to ensure compatibility and functionality in real-time 3D web applications within the PlayCanvas Editor.

Instructions

Parse the script after modification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetIdYes

Implementation Reference

  • Handler for 'assets:script:parse' websocket method: retrieves script asset, parses it using PlayCanvas editor API, returns parsed data or error.
    wsc.method('assets:script:parse', async (id) => {
        const asset = api.assets.get(id);
        if (!asset) {
            return { error: 'Asset not found' };
        }
        // FIXME: This is a hacky way to get the parsed script data. Expose a proper API for this.
        const [error, data] = await new Promise((resolve) => {
            window.editor.call('scripts:parse', asset.observer, (...data) => resolve(data));
        });
        if (error) {
            return { error };
        }
        if (Object.keys(data.scripts).length === 0) {
            return { error: 'Failed to parse script' };
        }
        log(`Parsed asset(${id}) script`);
        return { data };
    });
  • MCP tool registration for 'script_parse': defines schema (assetId: number), description, and handler that delegates to websocket call 'assets:script:parse'.
    mcp.tool(
        'script_parse',
        'Parse the script after modification',
        {
            assetId: z.number()
        },
        ({ assetId }) => {
            return wss.call('assets:script:parse', assetId);
        }
    );
  • Input schema for script_parse tool using Zod: assetId as number.
        assetId: z.number()
    },
Behavior1/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It fails to explain what parsing does (e.g., validates syntax, extracts metadata, returns errors), whether it's read-only or has side effects (e.g., updates state), permissions required, or error handling. The description is too vague to inform the agent about the tool's behavior beyond a basic action.

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

Conciseness4/5

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

The description is very concise with a single sentence, 'Parse the script after modification,' which is front-loaded and wastes no words. However, it's overly terse, bordering on under-specification, as it lacks necessary details for clarity and completeness, though it's structurally efficient.

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

Completeness1/5

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

Given the tool's complexity (involving parsing with a parameter), no annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover the parameter meaning, parsing behavior, output format, or error cases. For a tool that likely processes scripts, this leaves the agent with insufficient information to use it effectively.

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

Parameters2/5

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

The input schema has 1 parameter (assetId) with 0% description coverage, so the description must compensate. It doesn't mention 'assetId' or explain what it represents (e.g., ID of a script asset to parse). Without this, the parameter's purpose is unclear, leaving a significant gap in understanding how to invoke the tool correctly.

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

Purpose2/5

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

The description 'Parse the script after modification' restates the tool name 'script_parse' with minimal elaboration, making it tautological. It mentions 'script' and 'parse' but doesn't specify what parsing entails (e.g., syntax validation, extraction of components, error checking) or what resource is being parsed (e.g., a script asset, code block). Compared to siblings like 'set_script_text' or 'add_script_component_script', it lacks differentiation in scope or outcome.

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 (e.g., requires a modified script), exclusions (e.g., not for unmodified scripts), or related tools like 'set_script_text' for updates or 'add_script_component_script' for additions. The phrase 'after modification' implies a sequence but doesn't specify what constitutes modification or alternative workflows.

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