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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | An entity ID. | |
| scriptName | Yes |
Implementation Reference
- src/tools/entity.ts:108-118 (registration)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); } );
- src/tools/entity.ts:115-117 (handler)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); }
- src/tools/entity.ts:111-114 (schema)Input schema for the tool: object with 'id' (EntityIdSchema) and 'scriptName' (string).{ id: EntityIdSchema, scriptName: z.string() },
- src/tools/schema/common.ts:35-35 (schema)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.');