Skip to main content
Glama

ensure_collection

Creates a Figma variable collection by name and modes, or returns the existing one if it already matches, preventing duplicate collections.

Instructions

Idempotent VariableCollection creation — safe to retry.

Returns existing collection if one with the same name + identical mode list already exists, otherwise creates a new one. Spec §3.1.

Prefer this over create_collection — re-running with the same name + modes returns the existing collection instead of creating a duplicate.

Omit idempotency_key — the handler computes it canonically from (name, modes). Pass it only if you need strict concurrency-safety validation (LLMs should not try to compute SHA-256 inline; placeholder strings are rejected).

Returns {data: {collection_id, modes: [{modeId, name}], reused?: true}}.

Examples: ensure_collection({name: "Theme", modes: ["Light", "Dark"]})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCollection name
modesYesMode names (first becomes default)
idempotency_keyNoOptional. Handler auto-computes canonically if omitted. Pass only if you need strict concurrency-safety validation against the SHA-256 formula in spec §3.1.
Behavior5/5

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

No annotations provided, but the description fully discloses idempotent behavior, return shape (including reused flag), canonical key computation, and rejection of placeholder strings. All critical behavioral traits are covered.

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?

Concise and well-structured: starts with core concept, then conditions, return format, and an example. Every sentence adds necessary information without redundancy.

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

Completeness5/5

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

Despite no annotations or output schema, the description covers all needed aspects: idempotency, parameter usage, return shape, and an example. An agent can confidently invoke this tool with the given 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?

Schema coverage is 100%, baseline 3. Description adds value by explaining the idempotency_key's role and the 'canonical' computation, warning against manual SHA-256, and clarifying that the first mode becomes default. This goes beyond the schema descriptions.

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 it's for 'Idempotent VariableCollection creation' and distinguishes itself from the sibling 'create_collection' by explaining that it returns an existing collection instead of duplicating. The verb 'ensure' implies idempotency, and the description reinforces this.

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?

Explicitly advises 'Prefer this over create_collection' for idempotent creation, and provides guidance on when to omit or pass the idempotency_key. No ambiguity about use cases.

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/musepy/genable'

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