Skip to main content
Glama

Set Design Rules

set_design_rules
Idempotent

Define explicit design rules for AI code generation per Figma file and append or replace them to enforce spacing, color, and typography standards across sessions.

Instructions

Define explicit design rules that the AI should follow when generating code.

Rules supplement auto-inferred patterns and take precedence over them. Stored locally and persist across sessions.

Args:

  • figma_file_key (string): The Figma file key to associate rules with

  • rules (array): Design rules with optional category

  • mode ('replace' | 'append'): Whether to replace all rules or append (default: 'append')

Returns: Confirmation with total rule count.

Examples:

  • "Always use 8px grid" -> set_design_rules with rules: [{ rule: "Always use 8px grid", category: "spacing" }]

  • "Reset all rules" -> set_design_rules with mode: "replace", rules: [{ rule: "New rule" }]

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "figma_file_key": "<figma_file_key>",
      "rules": "<rules>"
    },
    "name": "set_design_rules"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo'replace' overwrites all rules, 'append' adds to existing (default: 'append')append
rulesYesDesign rules to add or set
figma_file_keyYesThe Figma file key

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A4/5.0
Behavior4/5

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

Adds substantive behavior beyond the annotations: local persistence across sessions, precedence over inferred patterns, replace-vs-append semantics, and the return value (confirmation with total rule count). One caveat: append mode grows the rule set on repeated identical calls, which sits awkwardly with idempotentHint=true — worth noting, though the annotations otherwise align (write operation, non-destructive).

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?

Front-loaded with a one-line purpose, then behavior, then examples; the behavioral claims precede the mechanics, which is the right order. The Args block largely duplicates the input schema and could be trimmed without losing information.

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 three-parameter mutation tool with no output schema, the definition covers persistence, precedence, mode semantics, and the return shape. It does not address error conditions (e.g., invalid Figma file key) or how appended rules interact with existing categories, but nothing essential for correct invocation is missing.

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 already 100%, so the baseline is 3, but the examples add real meaning the schema cannot: they show the nested rule object shape and demonstrate how mode='replace' is used to reset state. This goes beyond restating parameter types.

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?

Names a specific verb and resource — define design rules — and scopes them to AI code generation, which no sibling tool overlaps with. It stops short of explicitly positioning itself against adjacent tools (e.g., token extraction or code generation), so differentiation is implicit rather than stated.

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

Usage Guidelines4/5

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

Gives clear operating context: rules supplement auto-inferred patterns and take precedence over them, and the examples map intent ('Always use 8px grid' vs 'Reset all rules') to concrete invocations including the replace mode. There is no explicit when-not-to-use guidance or named alternative for retrieving existing rules.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.