Skip to main content
Glama

cocos_scaffold_score_system

Generate a score management system for Cocos Creator games with current/high score tracking, localStorage persistence, and optional UI label rendering.

Instructions

Generate GameScore.ts + meta - current/high score singleton with localStorage persistence and optional Label auto-render.

Runtime API::

GameScore.I.add(points)   // bump current; update high if beaten
GameScore.I.reset()       // clear current (high survives)
GameScore.I.current       // number, current run's score
GameScore.I.high          // number, best ever, persisted

The script has two optional @property(Label) slots: scoreLabel renders 'Score: N' on every change, highLabel renders 'High: N'. Wire them after attach::

cocos_set_uuid_property(scene, script_comp, 'scoreLabel', label_uuid)

... or let the user hook them up from the inspector if they prefer.

High-score persistence uses localStorage under the key cocos-mcp-high-score; write failures (private browsing, WeChat mini-game) are swallowed so gameplay never crashes over a missing save.

Returns {path, rel_path, uuid_standard, uuid_compressed}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
rel_pathNoGameScore.ts
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by detailing behavioral traits: it generates files with specific runtime API, handles persistence via localStorage with key 'cocos-mcp-high-score', swallows write failures to prevent crashes, and returns specific output data. It does not mention rate limits or auth needs, but covers core behavior adequately.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose. It uses bullet-like sections for runtime API and wiring instructions, but includes some technical details that could be streamlined. Most sentences earn their place by adding necessary context without excessive verbosity.

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

Completeness4/5

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

Given the complexity (scaffolding a score system), no annotations, no output schema, and low schema coverage, the description is fairly complete. It explains what the tool does, behavioral traits, optional features, and return values. However, it could improve by explicitly linking parameters to the project context and providing more usage scenarios.

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?

Schema description coverage is 0%, so the description must compensate. It does not explicitly mention the parameters (project_path, rel_path), but implies usage in a Cocos project context. The description adds value by explaining the tool's output and functionality, though it could directly reference parameters for better clarity. With 0% coverage, this is above baseline.

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 tool generates a GameScore.ts file with meta, specifying it creates a singleton for current/high scores with localStorage persistence and optional Label auto-render. It distinguishes from siblings by focusing on score system scaffolding rather than adding components or managing assets.

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 for creating a score system in a Cocos project, but does not explicitly state when to use this tool versus alternatives like other scaffolding tools (e.g., cocos_scaffold_player_controller) or general script addition tools. It provides some context about optional features but lacks explicit guidance on prerequisites or comparisons.

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