Skip to main content
Glama
playcanvas

PlayCanvas Editor MCP Server

Official
by playcanvas

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
NameRequiredDescriptionDefault
assetIdYes
textYes

Implementation Reference

  • 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); }
  • Input schema for the 'set_script_text' tool using Zod: assetId (number) and text (string).
    { assetId: z.number(), text: z.string() },
  • 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);

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