Skip to main content
Glama

cocos_attach_script

Attach a custom TypeScript script component to a node in Cocos Creator, enabling automated game development by setting component properties programmatically.

Instructions

Attach a custom TypeScript script component to a node.

script_uuid_compressed is the 23-char short form (run cocos_compress_uuid on the .ts.meta uuid).

props lets you set @property fields. Pass int values for node/component refs (they'll be wrapped as {"id": N}). Pass strings/numbers/bools for plain values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scene_pathYes
node_idYes
script_uuid_compressedYes
propsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions that 'props' sets '@property fields' and describes value handling, but it does not disclose critical behavioral traits such as whether this is a mutation (likely yes), error conditions, permissions needed, or side effects. The description adds some context but is insufficient for a mutation tool with zero annotation coverage.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded: the first sentence states the purpose clearly, followed by focused explanations for key parameters. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

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

Completeness3/5

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

Given the tool's complexity (4 parameters, 0% schema coverage, no annotations) and the presence of an output schema (which reduces need to explain return values), the description is partially complete. It covers parameter semantics for two parameters but lacks behavioral transparency and full parameter documentation, leaving gaps for a mutation tool.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates well by explaining 'script_uuid_compressed' (23-char short form from 'cocos_compress_uuid') and 'props' (sets @property fields with specific value types). It adds meaningful semantics beyond the schema, though it does not cover 'scene_path' or 'node_id' parameters, which remain undocumented.

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

Purpose5/5

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

The description clearly states the specific action ('Attach a custom TypeScript script component to a node'), identifies the resource ('node'), and distinguishes it from siblings like 'cocos_add_script' (which likely creates a script) and 'cocos_add_component' (which is more generic). The verb 'attach' is precise and differentiates it from creation or addition operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'script_uuid_compressed' and referencing 'cocos_compress_uuid', but it does not explicitly state when to use this tool versus alternatives like 'cocos_add_script' or 'cocos_add_component'. It provides context for parameter preparation but lacks explicit guidance on tool selection or prerequisites.

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

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/chenShengBiao/cocos-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server