Skip to main content
Glama

cocos_set_sprite_frame_border

Define 9-slice borders on sprite-frames to maintain crisp corners when stretching UI elements like buttons and panels in Cocos Creator.

Instructions

Set 9-slice border on an existing sprite-frame meta in pixels.

Required before using a PNG with cc.Sprite type=SLICED (rounded buttons, UI panels, dialog backgrounds — anything that should keep crisp corners while stretching the middle).

Idempotent. The meta must already be sprite-frame type (run cocos_upgrade_image_meta first if it's still texture-only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
meta_pathYes
topNo
bottomNo
leftNo
rightNo
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 of behavioral disclosure. It effectively describes key behavioral traits: the operation is idempotent (important for retry safety), has a prerequisite (meta must be sprite-frame type), and specifies the purpose (setting borders for sliced sprites). However, it doesn't mention error conditions, performance implications, or what happens when borders exceed image dimensions.

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 efficiently structured with three focused sentences: purpose statement, usage context, and prerequisites. Each sentence adds distinct value without redundancy. The information is front-loaded with the core functionality stated immediately.

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?

For a mutation tool with no annotations and no output schema, the description provides good coverage of purpose, prerequisites, and usage context. It explains the 'why' behind the tool and when to use it. However, it doesn't describe what the tool returns or error conditions, which would be helpful given the lack of structured output information.

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 for 5 parameters, the description must compensate. It explains that parameters represent border values 'in pixels' and mentions 'top, bottom, left, right' (though not explicitly listing all four). However, it doesn't fully explain the meta_path parameter's format or the meaning of zero values. The description adds meaningful context but doesn't completely document all parameters.

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 ('Set 9-slice border'), target resource ('existing sprite-frame meta'), and unit of measurement ('in pixels'). It distinguishes itself from sibling tools by focusing on sprite-frame border configuration rather than creation, attachment, or other operations listed among siblings.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Required before using a PNG with cc.Sprite type=SLICED'), when not to use it ('The meta must already be sprite-frame type'), and an alternative action to take first if needed ('run `cocos_upgrade_image_meta` first if it's still texture-only'). It also mentions typical use cases ('rounded buttons, UI panels, dialog backgrounds').

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