Skip to main content
Glama

cocos_anchor_to_edge

Anchor UI elements to parent edges or corners with customizable margins using Cocos Creator's Widget component for precise layout positioning.

Instructions

Pin node to an edge / corner of its parent via cc.Widget.

edge: top / bottom / left / right / top-left / top-right / bottom-left / bottom-right. margin: distance from the edge (from both edges for corners). Returns the Widget component id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scene_pathYes
node_idYes
edgeYes
marginNo

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 of behavioral disclosure. It mentions that the tool 'Returns the Widget component id,' which adds some context about the output. However, it does not describe critical behaviors such as whether this operation is destructive (modifies the node permanently), requires specific permissions, has side effects (e.g., affecting other components), or handles errors (e.g., invalid edge values). For a mutation tool with zero annotation coverage, this is a significant gap.

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 highly concise and well-structured. It uses a single sentence to state the purpose, followed by bullet-like explanations for parameters and the return value, with zero wasted words. Each part earns its place by providing essential information efficiently.

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 (a mutation operation with 4 parameters) and the presence of an output schema (which likely covers the return value), the description is partially complete. It explains key parameters but misses details on 'scene_path' and 'node_id', and lacks behavioral context (e.g., safety, errors). With no annotations and incomplete parameter coverage, it is adequate but has clear gaps, making it minimally viable.

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 for the lack of schema details. It effectively explains the 'edge' parameter by listing all possible string values (e.g., 'top', 'bottom-left') and clarifies 'margin' as 'distance from the edge (from both edges for corners).' This adds crucial semantic meaning beyond the schema's basic titles and types. However, it does not cover 'scene_path' or 'node_id', leaving two parameters undocumented, which slightly reduces the score.

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 tool's purpose: 'Pin node to an edge / corner of its parent via cc.Widget.' This specifies the action ('pin'), resource ('node'), and mechanism ('via cc.Widget'), making it understandable. However, it does not explicitly distinguish this tool from its many siblings (e.g., 'cocos_center_in_parent', 'cocos_move_node'), which handle related UI positioning tasks, so it misses full differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites (e.g., that the node must have a parent or support cc.Widget), exclusions, or comparisons with sibling tools like 'cocos_center_in_parent' or 'cocos_set_node_position'. This lack of context leaves the agent to infer usage based on the purpose alone.

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