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
| Name | Required | Description | Default |
|---|---|---|---|
| assetId | Yes |
Implementation Reference
- extension/main.js:483-500 (handler)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 }; });
- src/tools/assets/script.ts:19-28 (registration)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); } );
- src/tools/assets/script.ts:23-24 (schema)Input schema for script_parse tool using Zod: assetId as number.assetId: z.number() },