Skip to main content
Glama

cocos_add_script

Add TypeScript scripts with metadata to Cocos Creator projects, generating required files and UUIDs for scene integration.

Instructions

Write a TypeScript script + its meta into the project.

rel_path can be either:

  • bare name like 'GameManager' -> writes assets/scripts/GameManager.ts

  • full path like 'assets/scripts/sub/Foo.ts'

Returns {path, rel_path, uuid}. The uuid is the standard 36-char form; use cocos_compress_uuid to get the 23-char form needed in scene files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
rel_pathYes
sourceYes
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behaviors: it writes files (a mutation), returns specific data (path, rel_path, uuid), and notes UUID format details. However, it lacks information on permissions, error handling, or side effects, which are important for a write operation.

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 front-loaded with the core purpose, followed by specific details on parameters and return values. 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 no annotations, no output schema, and 0% schema coverage, the description does a decent job by covering the tool's action, parameter usage, and return data. However, for a mutation tool with three parameters, it lacks details on error cases, validation, or integration with other tools, leaving some gaps in completeness.

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?

The schema description coverage is 0%, so the description must compensate. It adds significant meaning for 'rel_path' by explaining its two formats and default behavior, and it implies 'source' as the script content. While 'project_path' is not detailed, the overall clarity on parameters is strong, though not exhaustive.

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

Purpose4/5

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

The description clearly states the action ('Write a TypeScript script + its meta') and resource ('into the project'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'cocos_add_and_attach_script', which might have overlapping functionality, so it falls short of a perfect score.

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 detailing how 'rel_path' works and mentioning a sibling tool ('cocos_compress_uuid') for UUID conversion, but it does not explicitly state when to use this tool versus alternatives like 'cocos_add_and_attach_script' or provide clear exclusions. This leaves some ambiguity in context.

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