set_script_text
Update script content in PlayCanvas Editor by specifying the asset ID and new text, enabling real-time 3D application development.
Instructions
Set script text
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assetId | Yes | ||
| text | Yes |
Implementation Reference
- src/tools/assets/script.ts:14-16 (handler)The handler function for the 'set_script_text' MCP tool. It receives assetId and text, and forwards the call to the WSS method 'assets:script:text:set'.({ assetId, text }) => { return wss.call('assets:script:text:set', assetId, text); }
- src/tools/assets/script.ts:10-13 (schema)Input schema for the 'set_script_text' tool using Zod: assetId (number) and text (string).{ assetId: z.number(), text: z.string() },
- src/tools/assets/script.ts:6-17 (registration)Registration of the 'set_script_text' tool using mcp.tool(), including name, description, schema, and handler. Note: startLine adjusted to capture full block.export const register = (mcp: McpServer, wss: WSS) => { mcp.tool( 'set_script_text', 'Set script text', { assetId: z.number(), text: z.string() }, ({ assetId, text }) => { return wss.call('assets:script:text:set', assetId, text); } );
- src/server.ts:81-81 (registration)Invocation of the register function for assets/script tools in the main MCP server setup.registerAssetScript(mcp, wss);