{
  "answers": {
    "c00": {
      "noul": 0.03,
      "type": "noul"
    },
    "c01": {
      "noul": 0.03,
      "type": "noul"
    },
    "c02": {
      "noul": 0.03,
      "type": "noul"
    },
    "c03": {
      "noul": 0.03,
      "type": "noul"
    },
    "c04": {
      "noul": 0.97,
      "type": "noul"
    },
    "c05": {
      "noul": 0.03,
      "type": "noul"
    },
    "c06": {
      "noul": 0.85,
      "type": "noul"
    },
    "w00": {
      "noul": 0.69,
      "type": "noul"
    },
    "w01": {
      "noul": 0.72,
      "type": "noul"
    },
    "w02": {
      "noul": 0.95,
      "type": "noul"
    },
    "w03": {
      "noul": 0.96,
      "type": "noul"
    },
    "w04": {
      "noul": 0.97,
      "type": "noul"
    },
    "w05": {
      "noul": 0.97,
      "type": "noul"
    },
    "w06": {
      "noul": 0.98,
      "type": "noul"
    },
    "w07": {
      "noul": 0.98,
      "type": "noul"
    },
    "w08": {
      "noul": 0.98,
      "type": "noul"
    }
  },
  "asked_at": "2026-11-23T06:33:08Z",
  "endpoint": "https://api.typesafe.ai/v1/systemone",
  "errors_helpful": [
    {
      "call": 0,
      "noul": 0.03,
      "question": "c00"
    },
    {
      "call": 1,
      "noul": 0.03,
      "question": "c01"
    },
    {
      "call": 2,
      "noul": 0.03,
      "question": "c02"
    },
    {
      "call": 3,
      "noul": 0.03,
      "question": "c03"
    },
    {
      "call": 4,
      "noul": 0.97,
      "question": "c04"
    },
    {
      "call": 5,
      "noul": 0.03,
      "question": "c05"
    },
    {
      "call": 6,
      "noul": 0.85,
      "question": "c06"
    }
  ],
  "format": "didrun.judgments.v1",
  "input_tokens": 35687,
  "method": "0.15.0",
  "model": "jev-1.14.0",
  "model_asked": "jev-1.14.0",
  "request": {
    "model": "jev-1.14.0",
    "questions": {
      "c00": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Figma plugin not connected. Run the 'Figma UI MCP Bridge' plugin in Figma Desktop first.",
          "tool": "figma_write"
        },
        "type": "noul"
      },
      "c01": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "code": {}
          },
          "parameter": "code",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Figma plugin not connected. Run the 'Figma UI MCP Bridge' plugin in Figma Desktop first.",
          "tool": "figma_write"
        },
        "type": "noul"
      },
      "c02": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Figma plugin not connected. Run the 'Figma UI MCP Bridge' plugin in Figma Desktop first.",
          "tool": "figma_read"
        },
        "type": "noul"
      },
      "c03": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "operation": {}
          },
          "parameter": "operation",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Figma plugin not connected. Run the 'Figma UI MCP Bridge' plugin in Figma Desktop first.",
          "tool": "figma_read"
        },
        "type": "noul"
      },
      "c04": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "section": {}
          },
          "parameter": "section",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Unknown section: \"[object Object]\". Valid sections: rules | layout | api | tokens | icons\n\n\n# figma-ui-mcp — API Reference\n\nCall `figma_docs` with a `section` param to load a specific part:\n\n| section | What's inside |\n|---------|---------------|\n| _(none)_ | **Quick-start checklist + Critical rules 0–9 + Design Library defaults** — load this first |\n| `\"rules\"` | Design rules 10–20 (spacing, radius, shadow, semantic colors, states) + component reuse |\n| `\"layout\"` | Auto-layout, button/card/badge/progress bar/mobile anchoring/header centering rules |\n| `\"api\"` | Create / Modify / Delete / Clone / Batch / Read operations + full workflow example |\n| `\"tokens\"` | setupDesignTokens, applyTextStyle, modifyVariable, applyVariable, multi-mode workflow |\n| `\"icons\"` | loadImage, loadIcon, loadIconIn, icon library priority table, coloring & sizing rules |\n\n**Recommended call order for a new design session:**\n1. `figma_docs` (no section) → rules + quick-start\n2. `figma_docs { section: \"layout\" }` → layout patterns\n3. `figma_docs { section: \"api\" }` → create/modify API\n4. `figma_docs { section: \"tokens\" }` → if using variables/multi-mode\n5. `figma_docs { section: \"icons\" }` → if placing icons or images\n",
          "tool": "figma_docs"
        },
        "type": "noul"
      },
      "c05": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "sessionId": {}
          },
          "parameter": "sessionId",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Figma plugin not connected. Run the 'Figma UI MCP Bridge' plugin in Figma Desktop first.",
          "tool": "figma_rules"
        },
        "type": "noul"
      },
      "c06": {
        "criteria": {
          "false": "The reply does not say the tool is missing: for example a generic failure, a crash, or a normal answer.",
          "true": "The reply says the tool is unknown, not found, or does not exist."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` tell the caller that there is no tool named `tool`?",
          "reply": "Unknown tool: didrun_unknown_tool",
          "tool": "didrun_unknown_tool"
        },
        "type": "noul"
      },
      "w00": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma writing quick-start and critical rules\n\nThe documentation tool returned the following guidance. **Both responses were truncated by the tool**, so the end of the critical rules and API reference was not available.\n\n## Quick-start\n\n```js\n// 1. Bootstrap design tokens. Safe to call every session.\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\", \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\", \"bg-surface\": \"#0F1117\",\n    \"bg-card\": \"#111318\", \"bg-elevated\": \"#0D0F14\",\n    \"border\": \"#1E2030\", \"text-primary\": \"#F0F2F5\",\n    \"text-secondary\": \"#8B8FA3\", \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\", \"negative\": \"#FF4757\",\n    \"warning\": \"#FFB547\"\n  },\n  numbers: {\n    \"radius-sm\": 8, \"radius-md\": 12, \"radius-lg\": 16,\n    \"spacing-xs\": 4, \"spacing-sm\": 8,\n    \"spacing-md\": 16, \"spacing-lg\": 24\n  }\n});\n\n// 2. Build a variable lookup.\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++)\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n\n// 3. Ensure the Design Library frame exists.\nawait figma.ensure_library();\n```\n\n### Non-negotiable rules\n\n- Use Figma variables for colors and text styles for typography; bind variables after creating nodes.\n- Use `figma.loadIcon()`, not emoji. Keep icons approximately half the size of their containers.\n- Draw backgrounds first, followed by overlays and content.\n- Don’t put overlapping rectangles, such as progress-bar layers, directly in auto-layout; use a non-layout wrapper.\n- Use `fillOpacity: 0`, not `opacity: 0`, when the children must remain visible.\n- Don’t use `counterAxisAlignItems: \"STRETCH\"`; use `\"MIN\"` on the parent and `layoutAlign: \"STRETCH\"` on children.\n- Use `figma_read` rather than unavailable sandbox calls such as `figma.getChildren()`, `figma.getNodeChildren()`, or `figma.read()`.\n- In",
          "done_when": "The tool replies show the quick-start and critical rules followed by the API reference section.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {},
              "reply": "\n# figma-ui-mcp — API Reference\n\nCall `figma_docs` with a `section` param to load a specific part:\n\n| section | What's inside |\n|---------|---------------|\n| _(none)_ | **Quick-start checklist + Critical rules 0–9 + Design Library defaults** — load this first |\n| `\"rules\"` | Design rules 10–20 (spacing, radius, shadow, semantic colors, states) + component reuse |\n| `\"layout\"` | Auto-layout, button/card/badge/progress bar/mobile anchoring/header centering rules |\n| `\"api\"` | Create / Modify / Delete / Clone / Batch / Read operations + full workflow example |\n| `\"tokens\"` | setupDesignTokens, applyTextStyle, modifyVariable, applyVariable, multi-mode workflow |\n| `\"icons\"` | loadImage, loadIcon, loadIconIn, icon library priority table, coloring & sizing rules |\n\n**Recommended call order for a new design session:**\n1. `figma_docs` (no section) → rules + quick-start\n2. `figma_docs { section: \"layout\" }` → layout patterns\n3. `figma_docs { section: \"api\" }` → create/modify API\n4. `figma_docs { section: \"tokens\" }` → if using variables/multi-mode\n5. `figma_docs { section: \"icons\" }` → if placing icons or images\n\n\n\n# figma-ui-mcp — Quick-Start & Critical Rules\n\n---\n\n## 🚨 CRITICAL QUICK-START CHECKLIST (follow EVERY time)\n\n```js\n// STEP 1 — Bootstrap design tokens (idempotent, safe to call every session)\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\", \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\", \"bg-surface\": \"#0F1117\", \"bg-card\": \"#111318\",\n    \"bg-elevated\": \"#0D0F14\", \"border\": \"#1E2030\",\n    \"text-primary\": \"#F0F2F5\", \"text-secondary\": \"#8B8FA3\", \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\", \"negative\": \"#FF4757\", \"warning\": \"#FFB547\",\n  },\n  numbers: { \"radius-sm\": 8, \"radius-md\": 12, \"radius-lg\": 16, \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24 }\n});\n\n// STEP 2 — Build variable lookup map\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++)\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n\n// STEP 3 — Ensure Design Library frame\nawait figma.ensure_library();\n```\n\n**Non-negotiable rules:**\n- ❌ NEVER hardcode hex in `fill`/`stroke` — always use `applyVariable` after create\n- ❌ NEVER use emoji as icons — use `figma.loadIcon(name, {size, fill})` (BUG-12: emoji misaligns & color-shifts in Figma)\n- ❌ NEVER set icon size >= container size — icon = container × 0.5\n- ❌ NEVER draw background image AFTER other elements — background FIRST, content on top\n- ❌ NEVER put overlapping rectangles inside auto-layout (progress bars) — use non-layout wrapper\n- ❌ NEVER use `opacity: 0` on wrapper frame — hides ALL children. Use `fillOpacity: 0` instead.\n- ❌ NEVER use `counterAxisAlignItems: \"STRETCH\"` — use `\"MIN\"` on parent + `layoutAlign: \"STRETCH\"` on each child (BUG-07)\n- ❌ NEVER call `figma.getChildren()`, `figma.getNodeChildren()`, or `figma.read()` — not available in sandbox. Use `figma_read` tool instead (BUG-09/10)\n- ❌ NEVER use H or V commands in SVG path `d` string — use `L` with explicit coords instead (BUG-11: `H 100` → `L 100 currentY`)\n- ❌ NEVER mix `layoutGrow: 1` with `primaryAxisAlignItems: \"CENTER\"` — grow consumes all space before CENTER applies, children shift (BUG-14). Use `\"SPACE_BETWEEN\"` or manual padding instead.\n- ❌ NEVER reuse variables/constants from a previous `figma_write` call — each call is an isolated sandbox (BUG-08). Redeclare all constants at the top of each call.\n- ✅ ALWAYS use auto-layout with `counterAxisAlignItems: \"CENTER\"` for icon+text rows\n- ✅ ALWAYS draw background first (bottom layer), then overlays, then content\n- ✅ For centered TEXT: pass BOTH `width` AND `textAlign: \"CENTER\"` — plugin auto-sets `textAutoResize: \"NONE\"`\n- ✅ For display numerics (fontSize ≥ 48): pass explicit `lineHeight` ≈ fontSize to prevent overflow\n- ❌ NEVER hardcode `fontSize`/`fontFamily`/`fontWeight` inline — use `setupDesignTokens({ textStyles })` then `applyTextStyle`\n\n**Reading hidden layers:**\nPass `includeHidden: true` to any read operation when user mentions \"hidden layer\", \"invisible element\", \"ẩn\", \"layer bị ẩn\":\n```js\nfigma_read({ operation: \"get_design\", nodeId: \"1:2\", includeHidden: true })\nfigma_read({ operation: \"search_nodes\", type: \"TEXT\", includeHidden: true })\n```\n\n**Multi-tab (2+ Figma files open simultaneously):**\n`figma_status` returns a `sessions` array — each entry has `id` (sessionId) + `fileName`.\nWhen user is working across multiple files, confirm which file to target, then pin `sessionId` for EVERY subsequent call.\nWithout it, ops go to whichever tab polled most recently — **not deterministic**.\n```js\n// Step 1 — inspect sessions from figma_status:\n// sessions: [\n//   { id: \"abc123\", fileName: \"Dashboard\", connected: true },\n//   { id: \"def456\", fileName: \"Onboarding\", connected: true }\n// ]\n\n// Step 2 — pin sessionId on every call:\nfigma_write({ code: \"...\", sessionId: \"abc123\" })\nfigma_read({ operation: \"get_selection\", sessionId: \"abc123\" })\nfigma_read({ operation: \"screenshot\", nodeId: \"1:2\", sessionId: \"abc123\" })\n```\n\n---\n\n## ⚑ MANDATORY DESIGN SYSTEM RULES (Rules 0–9)\n\n### Rule 0 — Token-First Workflow (HIGHEST PRIORITY)\n**NEVER hardcode hex colors.** Always use Figma Variables (Design Tokens).\n\n```js\n// WRONG\nawait figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\n\n// CORRECT — create with hex, then bind variable\nvar node = await figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\nawait figma.applyVariable({ nodeId: node.id, field: \"fill\", variableId: varMap[\"accent\"] });\n\n// Global rebrand — change 1 variable → ALL bound nodes update\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\n```\n\n### Rule 0b — Component-First Workflow (MANDATORY for repeated elements)\n**NEVER draw the same element twice.** Create a Component, then instantiate it.\n\n```js\nvar components = await figma.listComponents();\nvar btnExists = components.some(function(c) { return c.name === \"btn/primary\"; });\n\nif (!btnExists) {\n  var btnFrame = await figma.create({\n    type: \"FRAME\", name: \"btn/primary\", width: 120, height: 40, fill: \"#3B82F6\", cornerRadius: 10,\n    layoutMode: \"HORIZONTAL\", primaryAxisAlignItems: \"CENTER\", counterAxisAlignItems: \"CENTER\"\n  });\n  await figma.create({ type: \"TEXT\", parentId: btnFrame.id, content: \"Button\", fontSize: 14, fontWeight: \"SemiBold\", fill: \"#FFFFFF\" });\n  var comp = await figma.createComponent({ nodeId: btnFrame.id, name: \"btn/primary\" });\n}\n\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200 });\n```\n\n### Rule 1 — Design Library Frame\nBefore drawing any new design:\n1. Run `setupDesignTokens` (Rule 0)\n2. Call `figma.get_page_nodes()` — check if \"🎨 Design Library\" exists\n3. If not → `figma.ensure_library()`\n4. Library is visual reference only — actual tokens live in Figma Variables\n\n### Rule 2 — Library Frame Structure\n\"🎨 Design Library\" lives at x: -2000, y: 0 (off-canvas).\nContains: Colors, Text Styles, Components sections (visual reference).\n\n### Rule 3 — Read selection when user refers to a frame\nWhen user says \"this frame\", \"the selected one\", \"bạn thấy không\", \"cái đang chọn\":\n→ Immediately call `figma_read { operation: \"get_selection\" }`\n\n### Rule 4 — Naming convention\n- Frames: PascalCase (\"Trading Dashboard\", \"Signal Card\")\n- Components: kebab-case with type prefix (\"btn/primary-lg\", \"badge/success\")\n- Colors: \"color/{name}\" (\"color/bg-surface\", \"color/accent-purple\")\n\n### Rule 5 — Visual QA after every design\n1. Call `figma_read { operation: \"screenshot\" }` on root frame (scale: 0.4)\n2. Analyze: check overlaps, misalignment, text overflow\n3. Cross-check via `get_page_nodes` — compare x/y/width/height\n4. Fix → re-screenshot → repeat until clean\n\n### Rule 6 — Layer Order (CRITICAL)\nLast child drawn renders ON TOP.\n```\nCORRECT:  background → overlay → back btn → title → content\nW",
              "tool": "figma_docs"
            },
            {
              "arguments": {
                "section": "api"
              },
              "reply": "\n# figma-ui-mcp — API Reference (Create / Modify / Read / Ops)\n\n---\n\n## Pages\n```js\nawait figma.listPages()                              // [{ id, name }, ...]\nawait figma.setPage({ name: \"Dashboard\" })           // switch page\nawait figma.createPage({ name: \"Signals\" })          // create (no-op if exists)\n```\n\n---\n\n## Query nodes\n```js\nawait figma.query({ type: \"FRAME\" })                 // all frames on current page\nawait figma.query({ name: \"Sidebar\" })               // by name\nawait figma.query({ id: \"123:456\" })                 // by id\n// → [{ id, name, type, x, y, width, height, parentId }]\n```\n\n---\n\n## Create — returns { id, name, type, x, y, width, height }\n\n### FRAME\n```js\nvar f = await figma.create({\n  type: \"FRAME\", name: \"Screen\",\n  x: 0, y: 0, width: 1440, height: 900,\n  fill: \"#ffffff\", cornerRadius: 0,\n  stroke: \"#e2e8f0\", strokeWeight: 1,\n  // Auto-layout (optional):\n  layoutMode: \"VERTICAL\",\n  primaryAxisAlignItems: \"MIN\", counterAxisAlignItems: \"MIN\",\n  padding: 16, itemSpacing: 12,\n  primaryAxisSizingMode: \"FIXED\",   // \"FIXED\" | \"AUTO\"\n  counterAxisSizingMode: \"FIXED\",\n  // Effects (optional):\n  effects: [{ type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24 }],\n  // Gradient fill (optional):\n  // fill: { type: \"LINEAR_GRADIENT\", angle: 135, stops: [{pos:0,color:\"#7C3AED\"},{pos:1,color:\"#EC4899\"}] }\n  // Individual corners (optional):\n  // topLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0,\n  opacity: 1, visible: true,\n  insertIndex: 0,   // insert at specific position in parent (v2.5.7+)\n})\n```\n\n### RECTANGLE\n```js\nawait figma.create({ type: \"RECTANGLE\", name: \"Card\",\n  parentId: f.id, x: 24, y: 80, width: 280, height: 120,\n  fill: \"#1e293b\", cornerRadius: 12, stroke: \"#334155\", strokeWeight: 1 })\n```\n\n### ELLIPSE\n```js\nawait figma.create({ type: \"ELLIPSE\", name: \"Dot\",\n  parentId: f.id, x: 12, y: 12, width: 8, height: 8, fill: \"#22c55e\" })\n```\n\n### LINE\n```js\nawait figma.create({ type: \"LINE\", name: \"Divider\",\n  parentId: f.id, x: 0, y: 64, width: 240, height: 0,\n  stroke: \"#1e293b\", strokeWeight: 1 })\n```\n\n### TEXT\n```js\nawait figma.create({ type: \"TEXT\", name: \"Heading\",\n  parentId: f.id, x: 24, y: 24,\n  content: \"Total Balance\",    // also accepts: characters: \"...\"\n  fontSize: 14,\n  fontWeight: \"SemiBold\",      // Regular | Medium | SemiBold | Bold | Light | Heavy | Black | ExtraBold\n  fill: \"#f8fafc\",             // also accepts: fontColor, fills array\n  lineHeight: 20,              // px\n  textAlign: \"CENTER\",         // LEFT | CENTER | RIGHT (auto-sets textAutoResize: \"NONE\" with width)\n  width: 200, height: 40,      // both specified → fixed box (textAutoResize: \"NONE\"), size respected\n  layoutAlign: \"STRETCH\",      // for wrapping text in auto-layout\n  layoutGrow: 1,               // for growing text in auto-layout\n})\n```\n\n**TEXT sizing rules:**\n- `width` + `height` both set → fixed box, dimensions respected (textAutoResize: \"NONE\")\n- `width` only → auto-height wrapping (textAutoResize: \"HEIGHT\")\n- Neither → hug content (textAutoResize: \"WIDTH_AND_HEIGHT\", default)\n\n**Font baseline offset (Inter quirk):** Auto-layout CENTER may appear ~3-4px shifted upward due to Inter ascender whitespace.\nWorkaround: add `paddingBottom: 3` to the wrapper frame to visually re-center text.\n\n### VECTOR (SVG paths, arcs, curves)\n\n> ⚠️ **Known limitation:** Figma recalculates VECTOR bounding box from actual path geometry, ignoring specified `width`/`height`. For circular arcs that must align with an ELLIPSE, use `ELLIPSE` with `arcData` instead — it respects dimensions exactly.\n\n```js\n// Diagonal line\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 200, height: 100, d: \"M 0 0 L 200 100\",\n  stroke: \"#ff0000\", strokeWeight: 2, strokeCap: \"ROUND\" })\n\n// Arc (A command auto-converted to cubic Bézier)\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 300, height: 300,\n  d: \"M 150 7 A 143 143 0 1 1 29.26 226.62\",\n  stroke: \"#6C5CE7\", strokeWeight: 12, strokeCap: \"ROUND\" })\n\n// Filled wave\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 440, height: 80,\n  d: \"M 0 40 C 110 0, 220 80, 330 40 C 385 20, 420 30, 440 40 L 440 80 L 0 80 Z\",\n  fill: \"#0e7c3a\" })\n\n// ✅ PREFERRED for circular progress rings — use ELLIPSE + arcData (respects exact width/height)\n// arcData keys: startingAngle / endingAngle / innerRadius\n// Both startAngle/endAngle AND startingAngle/endingAngle are accepted (auto-normalized)\nawait figma.create({ type: \"ELLIPSE\", parentId: f.id,\n  x: 20, y: 20, width: 130, height: 130,\n  fill: \"#00000000\", stroke: \"#428DE7\", strokeWeight: 14,\n  arcData: { startingAngle: -1.5708, endingAngle: -1.5708 + 0.72 * 2 * Math.PI, innerRadius: 0 }})\n```\n\n**SVG path cheatsheet:** M=move, L=line, H=horizontal, V=vertical, C=cubic, Q=quadratic, A=arc, Z=close\n\n---\n\n## Modify\n```js\nawait figma.modify({ id: f.id, fill: \"#0f172a\" })\nawait figma.modify({ name: \"Card\", width: 300, cornerRadius: 16 })\nawait figma.modify({ id: \"123:456\", content: \"New text\", fontSize: 16 })\nawait figma.modify({ id: \"123:456\", fontFamily: \"SF Pro\", fontWeight: \"Bold\" })\nawait figma.modify({ id: \"123:456\", fontColor: \"#428DE7\" })  // alias for fill on text\nawait figma.modify({ id: \"123:456\", layoutMode: \"NONE\" })    // remove auto-layout\n```\n\n---\n\n## Delete\n```js\nawait figma.delete({ id: \"123:456\" })\nawait figma.delete({ name: \"Old Frame\" })\nawait figma.delete({ ids: [\"1:1\", \"1:2\", \"1:3\"] })  // batch delete\n```\n\n---\n\n## Components\n```js\nawait figma.listComponents()\n// → [{ id, name, key }]\n\nawait figma.createComponent({ nodeId: \"49:200\", name: \"btn/primary\" })\n// → { id, name, key, width, height }\n\nawait figma.instantiate({ componentId: comp.id, parentId: f.id, x: 0, y: 0 })\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200,\n  overrides: {\n    \"Label\":      { text: \"Sign Up\", fill: \"#FFFFFF\", fontSize: 16 },\n    \"Background\": { fill: \"#6C5CE7\", cornerRadius: 8 },\n    \"Icon\":       { visible: false }\n  }\n})\n\n// Cross-page document access (documentAccess: dynamic-page)\n// listComponents and instantiate auto-call loadAllPagesAsync internally.\n// If you run figma.query() / figma.modify() / your own findOne against a\n// component that lives on an unvisited page, call this first or it will miss.\nawait figma.loadAllPagesAsync();   // → { loaded: true, pageCount: N }\n```\n\n---\n\n## Node Operations\n```js\nawait figma.clone({ id: \"123:456\", x: 500, y: 0, name: \"Card Copy\" })\nawait figma.clone({ id: \"123:456\", parentId: otherFrame.id })\n\nconst group = await figma.group({ nodeIds: [\"1:2\", \"1:3\"], name: \"Header Group\" })\nconst { ungrouped } = await figma.ungroup({ id: group.id })\n\nawait figma.flatten({ id: \"1:2\" })\nawait figma.resize({ id: \"1:2\", width: 500, height: 300 })\nawait figma.set_selection({ nodeIds: [\"1:2\", \"1:3\"] })\n\nawait figma.set_viewport({ nodeId: \"1:2\" })           // zoom to node\nawait figma.set_viewport({ nodeName: \"Dashboard\" })\nawait figma.set_viewport({ center: { x: 500, y: 300 }, zoom: 0.5 })\n\n// Sandbox helpers (v2.5.10+)\nawait figma.getNodeById(\"89:393\")                     // read node detail by ID\nawait figma.zoom_to_fit({ nodeIds: [\"1:2\"] })         // alias for set_viewport\nawait figma.getCurrentPage()                          // returns current page info\n```\n\n---\n\n## Batch — up to 50 mixed operations in one round-trip\n```js\nconst result = await figma.batch([\n  { operation: \"create\", params: { type: \"RECTANGLE\", parentId: f.id, width: 100, height: 100, fill: \"#FF0000\" } },\n  { operation: \"create\", params: { type: \"TEXT\", parentId: f.id, content: \"Hello\", fontSize: 14, fill: \"#FFFFFF\" } },\n  { operation: \"modify\", params: { id: \"1:5\", fill: \"#00FF00\" } },\n  { operation: \"delete\", params: { id: \"1:99\" } },\n  { operation: \"delete\", params: { ids: [\"2:1\", \"2:2\"] } },\n]);\n// → { results: [{index, operation, success, data}], total: 5, succeeded: 5 }\n```\n\n---\n\n## Read Operations (also available in figma_write",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma writing quick-start guide and its critical rules, then show the API reference section."
        },
        "type": "noul"
      },
      "w01": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma writing quick-start and critical rules\n\nThe documentation tool returned the following quick-start guidance. **Both documentation responses were truncated by the tool**, so the complete rules and API section were not available.\n\n## Quick-start checklist\n\n```js\n// 1. Bootstrap design tokens. Safe to call every session.\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\", \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\", \"bg-surface\": \"#0F1117\",\n    \"bg-card\": \"#111318\", \"bg-elevated\": \"#0D0F14\",\n    \"border\": \"#1E2030\",\n    \"text-primary\": \"#F0F2F5\", \"text-secondary\": \"#8B8FA3\",\n    \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\", \"negative\": \"#FF4757\", \"warning\": \"#FFB547\",\n  },\n  numbers: {\n    \"radius-sm\": 8, \"radius-md\": 12, \"radius-lg\": 16,\n    \"spacing-xs\": 4, \"spacing-sm\": 8,\n    \"spacing-md\": 16, \"spacing-lg\": 24\n  }\n});\n\n// 2. Build a variable lookup map.\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++)\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n\n// 3. Ensure the Design Library frame exists.\nawait figma.ensure_library();\n```\n\n### Non-negotiable rules\n\n- Bind fills and strokes to variables with `applyVariable`; use text styles rather than hardcoding typography.\n- Use `figma.loadIcon`, not emoji. Icons should be about half the size of their container.\n- Draw backgrounds first, then overlays and content. The last child drawn is on top.\n- Don’t put overlapping rectangles inside auto-layout; use a non-layout wrapper for progress bars.\n- Don’t set wrapper `opacity: 0` when its children must remain visible; use `fillOpacity: 0`.\n- Don’t use `counterAxisAlignItems: \"STRETCH\"`; use `\"MIN\"` on the parent and `layoutAlign: \"STRETCH\"` on children.\n- Don’t call `figma.getChildren()`, `figma.getNodeChildren()`, or `figma.read()`; use",
          "done_when": "The tool replies show the quick-start and critical rules followed by the API reference section.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {},
              "reply": "\n# figma-ui-mcp — API Reference\n\nCall `figma_docs` with a `section` param to load a specific part:\n\n| section | What's inside |\n|---------|---------------|\n| _(none)_ | **Quick-start checklist + Critical rules 0–9 + Design Library defaults** — load this first |\n| `\"rules\"` | Design rules 10–20 (spacing, radius, shadow, semantic colors, states) + component reuse |\n| `\"layout\"` | Auto-layout, button/card/badge/progress bar/mobile anchoring/header centering rules |\n| `\"api\"` | Create / Modify / Delete / Clone / Batch / Read operations + full workflow example |\n| `\"tokens\"` | setupDesignTokens, applyTextStyle, modifyVariable, applyVariable, multi-mode workflow |\n| `\"icons\"` | loadImage, loadIcon, loadIconIn, icon library priority table, coloring & sizing rules |\n\n**Recommended call order for a new design session:**\n1. `figma_docs` (no section) → rules + quick-start\n2. `figma_docs { section: \"layout\" }` → layout patterns\n3. `figma_docs { section: \"api\" }` → create/modify API\n4. `figma_docs { section: \"tokens\" }` → if using variables/multi-mode\n5. `figma_docs { section: \"icons\" }` → if placing icons or images\n\n\n\n# figma-ui-mcp — Quick-Start & Critical Rules\n\n---\n\n## 🚨 CRITICAL QUICK-START CHECKLIST (follow EVERY time)\n\n```js\n// STEP 1 — Bootstrap design tokens (idempotent, safe to call every session)\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\", \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\", \"bg-surface\": \"#0F1117\", \"bg-card\": \"#111318\",\n    \"bg-elevated\": \"#0D0F14\", \"border\": \"#1E2030\",\n    \"text-primary\": \"#F0F2F5\", \"text-secondary\": \"#8B8FA3\", \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\", \"negative\": \"#FF4757\", \"warning\": \"#FFB547\",\n  },\n  numbers: { \"radius-sm\": 8, \"radius-md\": 12, \"radius-lg\": 16, \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24 }\n});\n\n// STEP 2 — Build variable lookup map\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++)\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n\n// STEP 3 — Ensure Design Library frame\nawait figma.ensure_library();\n```\n\n**Non-negotiable rules:**\n- ❌ NEVER hardcode hex in `fill`/`stroke` — always use `applyVariable` after create\n- ❌ NEVER use emoji as icons — use `figma.loadIcon(name, {size, fill})` (BUG-12: emoji misaligns & color-shifts in Figma)\n- ❌ NEVER set icon size >= container size — icon = container × 0.5\n- ❌ NEVER draw background image AFTER other elements — background FIRST, content on top\n- ❌ NEVER put overlapping rectangles inside auto-layout (progress bars) — use non-layout wrapper\n- ❌ NEVER use `opacity: 0` on wrapper frame — hides ALL children. Use `fillOpacity: 0` instead.\n- ❌ NEVER use `counterAxisAlignItems: \"STRETCH\"` — use `\"MIN\"` on parent + `layoutAlign: \"STRETCH\"` on each child (BUG-07)\n- ❌ NEVER call `figma.getChildren()`, `figma.getNodeChildren()`, or `figma.read()` — not available in sandbox. Use `figma_read` tool instead (BUG-09/10)\n- ❌ NEVER use H or V commands in SVG path `d` string — use `L` with explicit coords instead (BUG-11: `H 100` → `L 100 currentY`)\n- ❌ NEVER mix `layoutGrow: 1` with `primaryAxisAlignItems: \"CENTER\"` — grow consumes all space before CENTER applies, children shift (BUG-14). Use `\"SPACE_BETWEEN\"` or manual padding instead.\n- ❌ NEVER reuse variables/constants from a previous `figma_write` call — each call is an isolated sandbox (BUG-08). Redeclare all constants at the top of each call.\n- ✅ ALWAYS use auto-layout with `counterAxisAlignItems: \"CENTER\"` for icon+text rows\n- ✅ ALWAYS draw background first (bottom layer), then overlays, then content\n- ✅ For centered TEXT: pass BOTH `width` AND `textAlign: \"CENTER\"` — plugin auto-sets `textAutoResize: \"NONE\"`\n- ✅ For display numerics (fontSize ≥ 48): pass explicit `lineHeight` ≈ fontSize to prevent overflow\n- ❌ NEVER hardcode `fontSize`/`fontFamily`/`fontWeight` inline — use `setupDesignTokens({ textStyles })` then `applyTextStyle`\n\n**Reading hidden layers:**\nPass `includeHidden: true` to any read operation when user mentions \"hidden layer\", \"invisible element\", \"ẩn\", \"layer bị ẩn\":\n```js\nfigma_read({ operation: \"get_design\", nodeId: \"1:2\", includeHidden: true })\nfigma_read({ operation: \"search_nodes\", type: \"TEXT\", includeHidden: true })\n```\n\n**Multi-tab (2+ Figma files open simultaneously):**\n`figma_status` returns a `sessions` array — each entry has `id` (sessionId) + `fileName`.\nWhen user is working across multiple files, confirm which file to target, then pin `sessionId` for EVERY subsequent call.\nWithout it, ops go to whichever tab polled most recently — **not deterministic**.\n```js\n// Step 1 — inspect sessions from figma_status:\n// sessions: [\n//   { id: \"abc123\", fileName: \"Dashboard\", connected: true },\n//   { id: \"def456\", fileName: \"Onboarding\", connected: true }\n// ]\n\n// Step 2 — pin sessionId on every call:\nfigma_write({ code: \"...\", sessionId: \"abc123\" })\nfigma_read({ operation: \"get_selection\", sessionId: \"abc123\" })\nfigma_read({ operation: \"screenshot\", nodeId: \"1:2\", sessionId: \"abc123\" })\n```\n\n---\n\n## ⚑ MANDATORY DESIGN SYSTEM RULES (Rules 0–9)\n\n### Rule 0 — Token-First Workflow (HIGHEST PRIORITY)\n**NEVER hardcode hex colors.** Always use Figma Variables (Design Tokens).\n\n```js\n// WRONG\nawait figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\n\n// CORRECT — create with hex, then bind variable\nvar node = await figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\nawait figma.applyVariable({ nodeId: node.id, field: \"fill\", variableId: varMap[\"accent\"] });\n\n// Global rebrand — change 1 variable → ALL bound nodes update\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\n```\n\n### Rule 0b — Component-First Workflow (MANDATORY for repeated elements)\n**NEVER draw the same element twice.** Create a Component, then instantiate it.\n\n```js\nvar components = await figma.listComponents();\nvar btnExists = components.some(function(c) { return c.name === \"btn/primary\"; });\n\nif (!btnExists) {\n  var btnFrame = await figma.create({\n    type: \"FRAME\", name: \"btn/primary\", width: 120, height: 40, fill: \"#3B82F6\", cornerRadius: 10,\n    layoutMode: \"HORIZONTAL\", primaryAxisAlignItems: \"CENTER\", counterAxisAlignItems: \"CENTER\"\n  });\n  await figma.create({ type: \"TEXT\", parentId: btnFrame.id, content: \"Button\", fontSize: 14, fontWeight: \"SemiBold\", fill: \"#FFFFFF\" });\n  var comp = await figma.createComponent({ nodeId: btnFrame.id, name: \"btn/primary\" });\n}\n\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200 });\n```\n\n### Rule 1 — Design Library Frame\nBefore drawing any new design:\n1. Run `setupDesignTokens` (Rule 0)\n2. Call `figma.get_page_nodes()` — check if \"🎨 Design Library\" exists\n3. If not → `figma.ensure_library()`\n4. Library is visual reference only — actual tokens live in Figma Variables\n\n### Rule 2 — Library Frame Structure\n\"🎨 Design Library\" lives at x: -2000, y: 0 (off-canvas).\nContains: Colors, Text Styles, Components sections (visual reference).\n\n### Rule 3 — Read selection when user refers to a frame\nWhen user says \"this frame\", \"the selected one\", \"bạn thấy không\", \"cái đang chọn\":\n→ Immediately call `figma_read { operation: \"get_selection\" }`\n\n### Rule 4 — Naming convention\n- Frames: PascalCase (\"Trading Dashboard\", \"Signal Card\")\n- Components: kebab-case with type prefix (\"btn/primary-lg\", \"badge/success\")\n- Colors: \"color/{name}\" (\"color/bg-surface\", \"color/accent-purple\")\n\n### Rule 5 — Visual QA after every design\n1. Call `figma_read { operation: \"screenshot\" }` on root frame (scale: 0.4)\n2. Analyze: check overlaps, misalignment, text overflow\n3. Cross-check via `get_page_nodes` — compare x/y/width/height\n4. Fix → re-screenshot → repeat until clean\n\n### Rule 6 — Layer Order (CRITICAL)\nLast child drawn renders ON TOP.\n```\nCORRECT:  background → overlay → back btn → title → content\nW",
              "tool": "figma_docs"
            },
            {
              "arguments": {
                "section": "api"
              },
              "reply": "\n# figma-ui-mcp — API Reference (Create / Modify / Read / Ops)\n\n---\n\n## Pages\n```js\nawait figma.listPages()                              // [{ id, name }, ...]\nawait figma.setPage({ name: \"Dashboard\" })           // switch page\nawait figma.createPage({ name: \"Signals\" })          // create (no-op if exists)\n```\n\n---\n\n## Query nodes\n```js\nawait figma.query({ type: \"FRAME\" })                 // all frames on current page\nawait figma.query({ name: \"Sidebar\" })               // by name\nawait figma.query({ id: \"123:456\" })                 // by id\n// → [{ id, name, type, x, y, width, height, parentId }]\n```\n\n---\n\n## Create — returns { id, name, type, x, y, width, height }\n\n### FRAME\n```js\nvar f = await figma.create({\n  type: \"FRAME\", name: \"Screen\",\n  x: 0, y: 0, width: 1440, height: 900,\n  fill: \"#ffffff\", cornerRadius: 0,\n  stroke: \"#e2e8f0\", strokeWeight: 1,\n  // Auto-layout (optional):\n  layoutMode: \"VERTICAL\",\n  primaryAxisAlignItems: \"MIN\", counterAxisAlignItems: \"MIN\",\n  padding: 16, itemSpacing: 12,\n  primaryAxisSizingMode: \"FIXED\",   // \"FIXED\" | \"AUTO\"\n  counterAxisSizingMode: \"FIXED\",\n  // Effects (optional):\n  effects: [{ type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24 }],\n  // Gradient fill (optional):\n  // fill: { type: \"LINEAR_GRADIENT\", angle: 135, stops: [{pos:0,color:\"#7C3AED\"},{pos:1,color:\"#EC4899\"}] }\n  // Individual corners (optional):\n  // topLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0,\n  opacity: 1, visible: true,\n  insertIndex: 0,   // insert at specific position in parent (v2.5.7+)\n})\n```\n\n### RECTANGLE\n```js\nawait figma.create({ type: \"RECTANGLE\", name: \"Card\",\n  parentId: f.id, x: 24, y: 80, width: 280, height: 120,\n  fill: \"#1e293b\", cornerRadius: 12, stroke: \"#334155\", strokeWeight: 1 })\n```\n\n### ELLIPSE\n```js\nawait figma.create({ type: \"ELLIPSE\", name: \"Dot\",\n  parentId: f.id, x: 12, y: 12, width: 8, height: 8, fill: \"#22c55e\" })\n```\n\n### LINE\n```js\nawait figma.create({ type: \"LINE\", name: \"Divider\",\n  parentId: f.id, x: 0, y: 64, width: 240, height: 0,\n  stroke: \"#1e293b\", strokeWeight: 1 })\n```\n\n### TEXT\n```js\nawait figma.create({ type: \"TEXT\", name: \"Heading\",\n  parentId: f.id, x: 24, y: 24,\n  content: \"Total Balance\",    // also accepts: characters: \"...\"\n  fontSize: 14,\n  fontWeight: \"SemiBold\",      // Regular | Medium | SemiBold | Bold | Light | Heavy | Black | ExtraBold\n  fill: \"#f8fafc\",             // also accepts: fontColor, fills array\n  lineHeight: 20,              // px\n  textAlign: \"CENTER\",         // LEFT | CENTER | RIGHT (auto-sets textAutoResize: \"NONE\" with width)\n  width: 200, height: 40,      // both specified → fixed box (textAutoResize: \"NONE\"), size respected\n  layoutAlign: \"STRETCH\",      // for wrapping text in auto-layout\n  layoutGrow: 1,               // for growing text in auto-layout\n})\n```\n\n**TEXT sizing rules:**\n- `width` + `height` both set → fixed box, dimensions respected (textAutoResize: \"NONE\")\n- `width` only → auto-height wrapping (textAutoResize: \"HEIGHT\")\n- Neither → hug content (textAutoResize: \"WIDTH_AND_HEIGHT\", default)\n\n**Font baseline offset (Inter quirk):** Auto-layout CENTER may appear ~3-4px shifted upward due to Inter ascender whitespace.\nWorkaround: add `paddingBottom: 3` to the wrapper frame to visually re-center text.\n\n### VECTOR (SVG paths, arcs, curves)\n\n> ⚠️ **Known limitation:** Figma recalculates VECTOR bounding box from actual path geometry, ignoring specified `width`/`height`. For circular arcs that must align with an ELLIPSE, use `ELLIPSE` with `arcData` instead — it respects dimensions exactly.\n\n```js\n// Diagonal line\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 200, height: 100, d: \"M 0 0 L 200 100\",\n  stroke: \"#ff0000\", strokeWeight: 2, strokeCap: \"ROUND\" })\n\n// Arc (A command auto-converted to cubic Bézier)\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 300, height: 300,\n  d: \"M 150 7 A 143 143 0 1 1 29.26 226.62\",\n  stroke: \"#6C5CE7\", strokeWeight: 12, strokeCap: \"ROUND\" })\n\n// Filled wave\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 440, height: 80,\n  d: \"M 0 40 C 110 0, 220 80, 330 40 C 385 20, 420 30, 440 40 L 440 80 L 0 80 Z\",\n  fill: \"#0e7c3a\" })\n\n// ✅ PREFERRED for circular progress rings — use ELLIPSE + arcData (respects exact width/height)\n// arcData keys: startingAngle / endingAngle / innerRadius\n// Both startAngle/endAngle AND startingAngle/endingAngle are accepted (auto-normalized)\nawait figma.create({ type: \"ELLIPSE\", parentId: f.id,\n  x: 20, y: 20, width: 130, height: 130,\n  fill: \"#00000000\", stroke: \"#428DE7\", strokeWeight: 14,\n  arcData: { startingAngle: -1.5708, endingAngle: -1.5708 + 0.72 * 2 * Math.PI, innerRadius: 0 }})\n```\n\n**SVG path cheatsheet:** M=move, L=line, H=horizontal, V=vertical, C=cubic, Q=quadratic, A=arc, Z=close\n\n---\n\n## Modify\n```js\nawait figma.modify({ id: f.id, fill: \"#0f172a\" })\nawait figma.modify({ name: \"Card\", width: 300, cornerRadius: 16 })\nawait figma.modify({ id: \"123:456\", content: \"New text\", fontSize: 16 })\nawait figma.modify({ id: \"123:456\", fontFamily: \"SF Pro\", fontWeight: \"Bold\" })\nawait figma.modify({ id: \"123:456\", fontColor: \"#428DE7\" })  // alias for fill on text\nawait figma.modify({ id: \"123:456\", layoutMode: \"NONE\" })    // remove auto-layout\n```\n\n---\n\n## Delete\n```js\nawait figma.delete({ id: \"123:456\" })\nawait figma.delete({ name: \"Old Frame\" })\nawait figma.delete({ ids: [\"1:1\", \"1:2\", \"1:3\"] })  // batch delete\n```\n\n---\n\n## Components\n```js\nawait figma.listComponents()\n// → [{ id, name, key }]\n\nawait figma.createComponent({ nodeId: \"49:200\", name: \"btn/primary\" })\n// → { id, name, key, width, height }\n\nawait figma.instantiate({ componentId: comp.id, parentId: f.id, x: 0, y: 0 })\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200,\n  overrides: {\n    \"Label\":      { text: \"Sign Up\", fill: \"#FFFFFF\", fontSize: 16 },\n    \"Background\": { fill: \"#6C5CE7\", cornerRadius: 8 },\n    \"Icon\":       { visible: false }\n  }\n})\n\n// Cross-page document access (documentAccess: dynamic-page)\n// listComponents and instantiate auto-call loadAllPagesAsync internally.\n// If you run figma.query() / figma.modify() / your own findOne against a\n// component that lives on an unvisited page, call this first or it will miss.\nawait figma.loadAllPagesAsync();   // → { loaded: true, pageCount: N }\n```\n\n---\n\n## Node Operations\n```js\nawait figma.clone({ id: \"123:456\", x: 500, y: 0, name: \"Card Copy\" })\nawait figma.clone({ id: \"123:456\", parentId: otherFrame.id })\n\nconst group = await figma.group({ nodeIds: [\"1:2\", \"1:3\"], name: \"Header Group\" })\nconst { ungrouped } = await figma.ungroup({ id: group.id })\n\nawait figma.flatten({ id: \"1:2\" })\nawait figma.resize({ id: \"1:2\", width: 500, height: 300 })\nawait figma.set_selection({ nodeIds: [\"1:2\", \"1:3\"] })\n\nawait figma.set_viewport({ nodeId: \"1:2\" })           // zoom to node\nawait figma.set_viewport({ nodeName: \"Dashboard\" })\nawait figma.set_viewport({ center: { x: 500, y: 300 }, zoom: 0.5 })\n\n// Sandbox helpers (v2.5.10+)\nawait figma.getNodeById(\"89:393\")                     // read node detail by ID\nawait figma.zoom_to_fit({ nodeIds: [\"1:2\"] })         // alias for set_viewport\nawait figma.getCurrentPage()                          // returns current page info\n```\n\n---\n\n## Batch — up to 50 mixed operations in one round-trip\n```js\nconst result = await figma.batch([\n  { operation: \"create\", params: { type: \"RECTANGLE\", parentId: f.id, width: 100, height: 100, fill: \"#FF0000\" } },\n  { operation: \"create\", params: { type: \"TEXT\", parentId: f.id, content: \"Hello\", fontSize: 14, fill: \"#FFFFFF\" } },\n  { operation: \"modify\", params: { id: \"1:5\", fill: \"#00FF00\" } },\n  { operation: \"delete\", params: { id: \"1:99\" } },\n  { operation: \"delete\", params: { ids: [\"2:1\", \"2:2\"] } },\n]);\n// → { results: [{index, operation, success, data}], total: 5, succeeded: 5 }\n```\n\n---\n\n## Read Operations (also available in figma_write",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma writing quick-start guide and its critical rules, then show the API reference section."
        },
        "type": "noul"
      },
      "w02": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma writing quick-start and critical rules\n\nThe documentation recommends this order for a new design session:\n\n1. Load the quick-start and critical rules.\n2. Load the `layout` section for layout patterns.\n3. Load the `api` section for create and modify operations.\n4. Load `tokens` when using variables or multiple modes.\n5. Load `icons` when placing icons or images.\n\n## Quick-start checklist\n\n```js\n// 1. Bootstrap design tokens.\n// This is idempotent and safe to call every session.\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\",\n    \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\",\n    \"bg-surface\": \"#0F1117\",\n    \"bg-card\": \"#111318\",\n    \"bg-elevated\": \"#0D0F14\",\n    \"border\": \"#1E2030\",\n    \"text-primary\": \"#F0F2F5\",\n    \"text-secondary\": \"#8B8FA3\",\n    \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\",\n    \"negative\": \"#FF4757\",\n    \"warning\": \"#FFB547\"\n  },\n  numbers: {\n    \"radius-sm\": 8,\n    \"radius-md\": 12,\n    \"radius-lg\": 16,\n    \"spacing-xs\": 4,\n    \"spacing-sm\": 8,\n    \"spacing-md\": 16,\n    \"spacing-lg\": 24\n  }\n});\n\n// 2. Build a variable lookup map.\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++) {\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n}\n\n// 3. Ensure the Design Library frame exists.\nawait figma.ensure_library();\n```\n\n## Non-negotiable rules\n\n- **Use variables for colors.** Bind fills and strokes with `applyVariable`; use text styles rather than hardcoding font size, family, and weight inline.\n- **Use icons, not emoji.** Load them with `figma.loadIcon(name, { size, fill })`; the recommended icon size is half its container size.\n- **Draw backgrounds first**, then overlays, then content. The last child drawn renders on top.\n- Do not place overlapping rectangles, such as progress-bar layers, directly inside auto-",
          "done_when": "The tool replies show the quick-start and critical rules followed by the API reference section.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {},
              "reply": "\n# figma-ui-mcp — API Reference\n\nCall `figma_docs` with a `section` param to load a specific part:\n\n| section | What's inside |\n|---------|---------------|\n| _(none)_ | **Quick-start checklist + Critical rules 0–9 + Design Library defaults** — load this first |\n| `\"rules\"` | Design rules 10–20 (spacing, radius, shadow, semantic colors, states) + component reuse |\n| `\"layout\"` | Auto-layout, button/card/badge/progress bar/mobile anchoring/header centering rules |\n| `\"api\"` | Create / Modify / Delete / Clone / Batch / Read operations + full workflow example |\n| `\"tokens\"` | setupDesignTokens, applyTextStyle, modifyVariable, applyVariable, multi-mode workflow |\n| `\"icons\"` | loadImage, loadIcon, loadIconIn, icon library priority table, coloring & sizing rules |\n\n**Recommended call order for a new design session:**\n1. `figma_docs` (no section) → rules + quick-start\n2. `figma_docs { section: \"layout\" }` → layout patterns\n3. `figma_docs { section: \"api\" }` → create/modify API\n4. `figma_docs { section: \"tokens\" }` → if using variables/multi-mode\n5. `figma_docs { section: \"icons\" }` → if placing icons or images\n\n\n\n# figma-ui-mcp — Quick-Start & Critical Rules\n\n---\n\n## 🚨 CRITICAL QUICK-START CHECKLIST (follow EVERY time)\n\n```js\n// STEP 1 — Bootstrap design tokens (idempotent, safe to call every session)\nvar tokens = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  colors: {\n    \"accent\": \"#3B82F6\", \"accent-dim\": \"#1D4ED8\",\n    \"bg-base\": \"#08090E\", \"bg-surface\": \"#0F1117\", \"bg-card\": \"#111318\",\n    \"bg-elevated\": \"#0D0F14\", \"border\": \"#1E2030\",\n    \"text-primary\": \"#F0F2F5\", \"text-secondary\": \"#8B8FA3\", \"text-muted\": \"#555872\",\n    \"positive\": \"#00DC82\", \"negative\": \"#FF4757\", \"warning\": \"#FFB547\",\n  },\n  numbers: { \"radius-sm\": 8, \"radius-md\": 12, \"radius-lg\": 16, \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24 }\n});\n\n// STEP 2 — Build variable lookup map\nvar vars = await figma.get_variables();\nvar varMap = {};\nfor (var ci = 0; ci < vars.collections.length; ci++)\n  for (var vi = 0; vi < vars.collections[ci].variables.length; vi++) {\n    var v = vars.collections[ci].variables[vi];\n    varMap[v.name] = v.id;\n  }\n\n// STEP 3 — Ensure Design Library frame\nawait figma.ensure_library();\n```\n\n**Non-negotiable rules:**\n- ❌ NEVER hardcode hex in `fill`/`stroke` — always use `applyVariable` after create\n- ❌ NEVER use emoji as icons — use `figma.loadIcon(name, {size, fill})` (BUG-12: emoji misaligns & color-shifts in Figma)\n- ❌ NEVER set icon size >= container size — icon = container × 0.5\n- ❌ NEVER draw background image AFTER other elements — background FIRST, content on top\n- ❌ NEVER put overlapping rectangles inside auto-layout (progress bars) — use non-layout wrapper\n- ❌ NEVER use `opacity: 0` on wrapper frame — hides ALL children. Use `fillOpacity: 0` instead.\n- ❌ NEVER use `counterAxisAlignItems: \"STRETCH\"` — use `\"MIN\"` on parent + `layoutAlign: \"STRETCH\"` on each child (BUG-07)\n- ❌ NEVER call `figma.getChildren()`, `figma.getNodeChildren()`, or `figma.read()` — not available in sandbox. Use `figma_read` tool instead (BUG-09/10)\n- ❌ NEVER use H or V commands in SVG path `d` string — use `L` with explicit coords instead (BUG-11: `H 100` → `L 100 currentY`)\n- ❌ NEVER mix `layoutGrow: 1` with `primaryAxisAlignItems: \"CENTER\"` — grow consumes all space before CENTER applies, children shift (BUG-14). Use `\"SPACE_BETWEEN\"` or manual padding instead.\n- ❌ NEVER reuse variables/constants from a previous `figma_write` call — each call is an isolated sandbox (BUG-08). Redeclare all constants at the top of each call.\n- ✅ ALWAYS use auto-layout with `counterAxisAlignItems: \"CENTER\"` for icon+text rows\n- ✅ ALWAYS draw background first (bottom layer), then overlays, then content\n- ✅ For centered TEXT: pass BOTH `width` AND `textAlign: \"CENTER\"` — plugin auto-sets `textAutoResize: \"NONE\"`\n- ✅ For display numerics (fontSize ≥ 48): pass explicit `lineHeight` ≈ fontSize to prevent overflow\n- ❌ NEVER hardcode `fontSize`/`fontFamily`/`fontWeight` inline — use `setupDesignTokens({ textStyles })` then `applyTextStyle`\n\n**Reading hidden layers:**\nPass `includeHidden: true` to any read operation when user mentions \"hidden layer\", \"invisible element\", \"ẩn\", \"layer bị ẩn\":\n```js\nfigma_read({ operation: \"get_design\", nodeId: \"1:2\", includeHidden: true })\nfigma_read({ operation: \"search_nodes\", type: \"TEXT\", includeHidden: true })\n```\n\n**Multi-tab (2+ Figma files open simultaneously):**\n`figma_status` returns a `sessions` array — each entry has `id` (sessionId) + `fileName`.\nWhen user is working across multiple files, confirm which file to target, then pin `sessionId` for EVERY subsequent call.\nWithout it, ops go to whichever tab polled most recently — **not deterministic**.\n```js\n// Step 1 — inspect sessions from figma_status:\n// sessions: [\n//   { id: \"abc123\", fileName: \"Dashboard\", connected: true },\n//   { id: \"def456\", fileName: \"Onboarding\", connected: true }\n// ]\n\n// Step 2 — pin sessionId on every call:\nfigma_write({ code: \"...\", sessionId: \"abc123\" })\nfigma_read({ operation: \"get_selection\", sessionId: \"abc123\" })\nfigma_read({ operation: \"screenshot\", nodeId: \"1:2\", sessionId: \"abc123\" })\n```\n\n---\n\n## ⚑ MANDATORY DESIGN SYSTEM RULES (Rules 0–9)\n\n### Rule 0 — Token-First Workflow (HIGHEST PRIORITY)\n**NEVER hardcode hex colors.** Always use Figma Variables (Design Tokens).\n\n```js\n// WRONG\nawait figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\n\n// CORRECT — create with hex, then bind variable\nvar node = await figma.create({ type: \"FRAME\", fill: \"#3B82F6\", ... });\nawait figma.applyVariable({ nodeId: node.id, field: \"fill\", variableId: varMap[\"accent\"] });\n\n// Global rebrand — change 1 variable → ALL bound nodes update\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\n```\n\n### Rule 0b — Component-First Workflow (MANDATORY for repeated elements)\n**NEVER draw the same element twice.** Create a Component, then instantiate it.\n\n```js\nvar components = await figma.listComponents();\nvar btnExists = components.some(function(c) { return c.name === \"btn/primary\"; });\n\nif (!btnExists) {\n  var btnFrame = await figma.create({\n    type: \"FRAME\", name: \"btn/primary\", width: 120, height: 40, fill: \"#3B82F6\", cornerRadius: 10,\n    layoutMode: \"HORIZONTAL\", primaryAxisAlignItems: \"CENTER\", counterAxisAlignItems: \"CENTER\"\n  });\n  await figma.create({ type: \"TEXT\", parentId: btnFrame.id, content: \"Button\", fontSize: 14, fontWeight: \"SemiBold\", fill: \"#FFFFFF\" });\n  var comp = await figma.createComponent({ nodeId: btnFrame.id, name: \"btn/primary\" });\n}\n\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200 });\n```\n\n### Rule 1 — Design Library Frame\nBefore drawing any new design:\n1. Run `setupDesignTokens` (Rule 0)\n2. Call `figma.get_page_nodes()` — check if \"🎨 Design Library\" exists\n3. If not → `figma.ensure_library()`\n4. Library is visual reference only — actual tokens live in Figma Variables\n\n### Rule 2 — Library Frame Structure\n\"🎨 Design Library\" lives at x: -2000, y: 0 (off-canvas).\nContains: Colors, Text Styles, Components sections (visual reference).\n\n### Rule 3 — Read selection when user refers to a frame\nWhen user says \"this frame\", \"the selected one\", \"bạn thấy không\", \"cái đang chọn\":\n→ Immediately call `figma_read { operation: \"get_selection\" }`\n\n### Rule 4 — Naming convention\n- Frames: PascalCase (\"Trading Dashboard\", \"Signal Card\")\n- Components: kebab-case with type prefix (\"btn/primary-lg\", \"badge/success\")\n- Colors: \"color/{name}\" (\"color/bg-surface\", \"color/accent-purple\")\n\n### Rule 5 — Visual QA after every design\n1. Call `figma_read { operation: \"screenshot\" }` on root frame (scale: 0.4)\n2. Analyze: check overlaps, misalignment, text overflow\n3. Cross-check via `get_page_nodes` — compare x/y/width/height\n4. Fix → re-screenshot → repeat until clean\n\n### Rule 6 — Layer Order (CRITICAL)\nLast child drawn renders ON TOP.\n```\nCORRECT:  background → overlay → back btn → title → content\nW",
              "tool": "figma_docs"
            },
            {
              "arguments": {
                "section": "api"
              },
              "reply": "\n# figma-ui-mcp — API Reference (Create / Modify / Read / Ops)\n\n---\n\n## Pages\n```js\nawait figma.listPages()                              // [{ id, name }, ...]\nawait figma.setPage({ name: \"Dashboard\" })           // switch page\nawait figma.createPage({ name: \"Signals\" })          // create (no-op if exists)\n```\n\n---\n\n## Query nodes\n```js\nawait figma.query({ type: \"FRAME\" })                 // all frames on current page\nawait figma.query({ name: \"Sidebar\" })               // by name\nawait figma.query({ id: \"123:456\" })                 // by id\n// → [{ id, name, type, x, y, width, height, parentId }]\n```\n\n---\n\n## Create — returns { id, name, type, x, y, width, height }\n\n### FRAME\n```js\nvar f = await figma.create({\n  type: \"FRAME\", name: \"Screen\",\n  x: 0, y: 0, width: 1440, height: 900,\n  fill: \"#ffffff\", cornerRadius: 0,\n  stroke: \"#e2e8f0\", strokeWeight: 1,\n  // Auto-layout (optional):\n  layoutMode: \"VERTICAL\",\n  primaryAxisAlignItems: \"MIN\", counterAxisAlignItems: \"MIN\",\n  padding: 16, itemSpacing: 12,\n  primaryAxisSizingMode: \"FIXED\",   // \"FIXED\" | \"AUTO\"\n  counterAxisSizingMode: \"FIXED\",\n  // Effects (optional):\n  effects: [{ type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24 }],\n  // Gradient fill (optional):\n  // fill: { type: \"LINEAR_GRADIENT\", angle: 135, stops: [{pos:0,color:\"#7C3AED\"},{pos:1,color:\"#EC4899\"}] }\n  // Individual corners (optional):\n  // topLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0,\n  opacity: 1, visible: true,\n  insertIndex: 0,   // insert at specific position in parent (v2.5.7+)\n})\n```\n\n### RECTANGLE\n```js\nawait figma.create({ type: \"RECTANGLE\", name: \"Card\",\n  parentId: f.id, x: 24, y: 80, width: 280, height: 120,\n  fill: \"#1e293b\", cornerRadius: 12, stroke: \"#334155\", strokeWeight: 1 })\n```\n\n### ELLIPSE\n```js\nawait figma.create({ type: \"ELLIPSE\", name: \"Dot\",\n  parentId: f.id, x: 12, y: 12, width: 8, height: 8, fill: \"#22c55e\" })\n```\n\n### LINE\n```js\nawait figma.create({ type: \"LINE\", name: \"Divider\",\n  parentId: f.id, x: 0, y: 64, width: 240, height: 0,\n  stroke: \"#1e293b\", strokeWeight: 1 })\n```\n\n### TEXT\n```js\nawait figma.create({ type: \"TEXT\", name: \"Heading\",\n  parentId: f.id, x: 24, y: 24,\n  content: \"Total Balance\",    // also accepts: characters: \"...\"\n  fontSize: 14,\n  fontWeight: \"SemiBold\",      // Regular | Medium | SemiBold | Bold | Light | Heavy | Black | ExtraBold\n  fill: \"#f8fafc\",             // also accepts: fontColor, fills array\n  lineHeight: 20,              // px\n  textAlign: \"CENTER\",         // LEFT | CENTER | RIGHT (auto-sets textAutoResize: \"NONE\" with width)\n  width: 200, height: 40,      // both specified → fixed box (textAutoResize: \"NONE\"), size respected\n  layoutAlign: \"STRETCH\",      // for wrapping text in auto-layout\n  layoutGrow: 1,               // for growing text in auto-layout\n})\n```\n\n**TEXT sizing rules:**\n- `width` + `height` both set → fixed box, dimensions respected (textAutoResize: \"NONE\")\n- `width` only → auto-height wrapping (textAutoResize: \"HEIGHT\")\n- Neither → hug content (textAutoResize: \"WIDTH_AND_HEIGHT\", default)\n\n**Font baseline offset (Inter quirk):** Auto-layout CENTER may appear ~3-4px shifted upward due to Inter ascender whitespace.\nWorkaround: add `paddingBottom: 3` to the wrapper frame to visually re-center text.\n\n### VECTOR (SVG paths, arcs, curves)\n\n> ⚠️ **Known limitation:** Figma recalculates VECTOR bounding box from actual path geometry, ignoring specified `width`/`height`. For circular arcs that must align with an ELLIPSE, use `ELLIPSE` with `arcData` instead — it respects dimensions exactly.\n\n```js\n// Diagonal line\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 200, height: 100, d: \"M 0 0 L 200 100\",\n  stroke: \"#ff0000\", strokeWeight: 2, strokeCap: \"ROUND\" })\n\n// Arc (A command auto-converted to cubic Bézier)\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 300, height: 300,\n  d: \"M 150 7 A 143 143 0 1 1 29.26 226.62\",\n  stroke: \"#6C5CE7\", strokeWeight: 12, strokeCap: \"ROUND\" })\n\n// Filled wave\nawait figma.create({ type: \"VECTOR\", parentId: f.id,\n  x: 0, y: 0, width: 440, height: 80,\n  d: \"M 0 40 C 110 0, 220 80, 330 40 C 385 20, 420 30, 440 40 L 440 80 L 0 80 Z\",\n  fill: \"#0e7c3a\" })\n\n// ✅ PREFERRED for circular progress rings — use ELLIPSE + arcData (respects exact width/height)\n// arcData keys: startingAngle / endingAngle / innerRadius\n// Both startAngle/endAngle AND startingAngle/endingAngle are accepted (auto-normalized)\nawait figma.create({ type: \"ELLIPSE\", parentId: f.id,\n  x: 20, y: 20, width: 130, height: 130,\n  fill: \"#00000000\", stroke: \"#428DE7\", strokeWeight: 14,\n  arcData: { startingAngle: -1.5708, endingAngle: -1.5708 + 0.72 * 2 * Math.PI, innerRadius: 0 }})\n```\n\n**SVG path cheatsheet:** M=move, L=line, H=horizontal, V=vertical, C=cubic, Q=quadratic, A=arc, Z=close\n\n---\n\n## Modify\n```js\nawait figma.modify({ id: f.id, fill: \"#0f172a\" })\nawait figma.modify({ name: \"Card\", width: 300, cornerRadius: 16 })\nawait figma.modify({ id: \"123:456\", content: \"New text\", fontSize: 16 })\nawait figma.modify({ id: \"123:456\", fontFamily: \"SF Pro\", fontWeight: \"Bold\" })\nawait figma.modify({ id: \"123:456\", fontColor: \"#428DE7\" })  // alias for fill on text\nawait figma.modify({ id: \"123:456\", layoutMode: \"NONE\" })    // remove auto-layout\n```\n\n---\n\n## Delete\n```js\nawait figma.delete({ id: \"123:456\" })\nawait figma.delete({ name: \"Old Frame\" })\nawait figma.delete({ ids: [\"1:1\", \"1:2\", \"1:3\"] })  // batch delete\n```\n\n---\n\n## Components\n```js\nawait figma.listComponents()\n// → [{ id, name, key }]\n\nawait figma.createComponent({ nodeId: \"49:200\", name: \"btn/primary\" })\n// → { id, name, key, width, height }\n\nawait figma.instantiate({ componentId: comp.id, parentId: f.id, x: 0, y: 0 })\nawait figma.instantiate({ componentName: \"btn/primary\", parentId: screen.id, x: 100, y: 200,\n  overrides: {\n    \"Label\":      { text: \"Sign Up\", fill: \"#FFFFFF\", fontSize: 16 },\n    \"Background\": { fill: \"#6C5CE7\", cornerRadius: 8 },\n    \"Icon\":       { visible: false }\n  }\n})\n\n// Cross-page document access (documentAccess: dynamic-page)\n// listComponents and instantiate auto-call loadAllPagesAsync internally.\n// If you run figma.query() / figma.modify() / your own findOne against a\n// component that lives on an unvisited page, call this first or it will miss.\nawait figma.loadAllPagesAsync();   // → { loaded: true, pageCount: N }\n```\n\n---\n\n## Node Operations\n```js\nawait figma.clone({ id: \"123:456\", x: 500, y: 0, name: \"Card Copy\" })\nawait figma.clone({ id: \"123:456\", parentId: otherFrame.id })\n\nconst group = await figma.group({ nodeIds: [\"1:2\", \"1:3\"], name: \"Header Group\" })\nconst { ungrouped } = await figma.ungroup({ id: group.id })\n\nawait figma.flatten({ id: \"1:2\" })\nawait figma.resize({ id: \"1:2\", width: 500, height: 300 })\nawait figma.set_selection({ nodeIds: [\"1:2\", \"1:3\"] })\n\nawait figma.set_viewport({ nodeId: \"1:2\" })           // zoom to node\nawait figma.set_viewport({ nodeName: \"Dashboard\" })\nawait figma.set_viewport({ center: { x: 500, y: 300 }, zoom: 0.5 })\n\n// Sandbox helpers (v2.5.10+)\nawait figma.getNodeById(\"89:393\")                     // read node detail by ID\nawait figma.zoom_to_fit({ nodeIds: [\"1:2\"] })         // alias for set_viewport\nawait figma.getCurrentPage()                          // returns current page info\n```\n\n---\n\n## Batch — up to 50 mixed operations in one round-trip\n```js\nconst result = await figma.batch([\n  { operation: \"create\", params: { type: \"RECTANGLE\", parentId: f.id, width: 100, height: 100, fill: \"#FF0000\" } },\n  { operation: \"create\", params: { type: \"TEXT\", parentId: f.id, content: \"Hello\", fontSize: 14, fill: \"#FFFFFF\" } },\n  { operation: \"modify\", params: { id: \"1:5\", fill: \"#00FF00\" } },\n  { operation: \"delete\", params: { id: \"1:99\" } },\n  { operation: \"delete\", params: { ids: [\"2:1\", \"2:2\"] } },\n]);\n// → { results: [{index, operation, success, data}], total: 5, succeeded: 5 }\n```\n\n---\n\n## Read Operations (also available in figma_write",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma writing quick-start guide and its critical rules, then show the API reference section."
        },
        "type": "noul"
      },
      "w03": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma design tokens: variables and modes\n\nThe design-token API can create variables, bind them to design properties, and switch their values by mode. The recommended starting point is **`setupDesignTokens`**, which is idempotent: it updates existing variables and creates missing ones.\n\n## Create a token collection\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  // COLOR variables\n  colors: {\n    \"accent\": \"#3B82F6\",\n    \"bg-base\": \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n  },\n\n  // FLOAT variables\n  numbers: {\n    \"spacing-sm\": 8,\n    \"spacing-md\": 16,\n    \"radius-md\": 12,\n  },\n\n  // FLOAT variables for typography\n  fontSizes: {\n    \"text-body\": 14,\n    \"text-heading-xl\": 24,\n  },\n\n  // STRING variables\n  fonts: {\n    \"font-primary\": \"Inter\",\n  },\n\n  // Curly braces bind style properties to variables.\n  textStyles: {\n    \"text/heading-xl\": {\n      fontFamily: \"{font-primary}\",\n      fontWeight: \"Bold\",\n      fontSize: \"{text-heading-xl}\",\n      lineHeight: 32,\n    },\n  },\n});\n```\n\nThe result includes the collection ID, created and updated variables, text styles, and total variable count.\n\n## Variables and modes\n\nModes let a collection hold different values for the same variable—for example, light and dark colors or different typography densities.\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\": {\n      light: \"#FFFFFF\",\n      dark: \"#0F1117\",\n    },\n    \"text-primary\": {\n      light: \"#111827\",\n      dark: \"#F9FAFB\",\n    },\n  },\n});\n```\n\nSet a collection’s mode on a frame, or clear its explicit mode:\n\n```js\nawait figma.setFrameVariableMode({\n  nodeId: frame.id,\n  collectionId,\n  modeName: \"dark\",\n});\n\nawait figma.clearFrameVariableMode({\n  nodeId: frame.id,\n  collectionId,\n});\n```\n\nModes also work for typography:\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"],\n  fontSizes: ",
          "done_when": "The tool reply contains the tokens documentation covering variables and modes.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {
                "section": "tokens"
              },
              "reply": "\n# figma-ui-mcp — Design Tokens & Variables\n\n---\n\n## setupDesignTokens — Bootstrap complete token system (idempotent)\n\nOne call creates all variables. Existing variables get updated; new ones are created.\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  // COLOR variables\n  colors: {\n    \"accent\":       \"#3B82F6\",\n    \"bg-base\":      \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n    \"positive\":     \"#00DC82\",\n  },\n\n  // FLOAT variables (spacing, radius, etc.)\n  numbers: {\n    \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24,\n    \"radius-sm\": 8,  \"radius-md\": 12, \"radius-lg\": 16,\n  },\n\n  // FLOAT variables for typography (v2.5.4+)\n  fontSizes: {\n    \"text-xs\": 11, \"text-sm\": 12, \"text-body\": 14,\n    \"text-heading-md\": 16, \"text-heading-lg\": 20, \"text-heading-xl\": 24,\n  },\n\n  // STRING variables for fonts (v2.5.4+)\n  fonts: {\n    \"font-primary\": \"Inter\",\n    \"font-display\": \"Playfair Display\",\n  },\n\n  // Text styles that reference variables above — {curly-braces} binds to variable\n  textStyles: {\n    \"text/heading-xl\": { fontFamily: \"{font-primary}\", fontWeight: \"Bold\",\n                         fontSize: \"{text-heading-xl}\", lineHeight: 32, letterSpacing: -0.4 },\n    \"text/body\":       { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-body}\", lineHeight: 20 },\n    \"text/caption\":    { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-xs}\", lineHeight: 16 },\n  }\n});\n// → { collectionId, created: [...], updated: [...], textStyles: [...], totalVariables: N }\n\n// Multi-mode: Light + Dark\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\":      { light: \"#FFFFFF\",  dark: \"#0F1117\" },\n    \"text-primary\": { light: \"#111827\",  dark: \"#F9FAFB\" },\n    \"accent\":       { light: \"#3B82F6\",  dark: \"#60A5FA\" },\n  }\n});\n\n// Multi-mode typography: Compact / Comfortable / Large\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"],\n  fontSizes: {\n    \"text-body\":       { compact: 12, comfortable: 14, large: 16 },\n    \"text-heading-xl\": { compact: 22, comfortable: 24, large: 28 },\n  }\n});\n// Switch frame mode:\nawait figma.setFrameVariableMode({ nodeId, collectionId, modeName: \"large\" });\n```\n\n---\n\n## applyTextStyle — Apply a text style by name (v2.5.4+)\n\n```js\nvar title = await figma.create({ type: \"TEXT\", content: \"Dashboard\", parentId: card.id });\nawait figma.applyTextStyle({ nodeId: title.id, styleName: \"text/heading-xl\" });\n// → { nodeId, styleName, styleId }\n```\n\nWhy use instead of inline props: font changes propagate, mode switches work, consistent across screens.\n\n---\n\n## modifyVariable — Change variable value (all bound nodes update)\n\n```js\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\nawait figma.modifyVariable({ variableId: \"VariableID:57:671\", value: \"#FF6B35\" });\nawait figma.modifyVariable({ variableName: \"spacing-md\", value: 20 });\nawait figma.modifyVariable({ variableName: \"font-primary\", value: \"SF Pro\" }); // font swap\n```\n\n---\n\n## applyVariable — Bind a variable to a node property\n\n```js\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableId: varMap[\"accent\"] });\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableName: \"accent\" }); // by name\n```\n\n**Supported fields:**\n\n| Field | Variable type | Notes |\n|-------|--------------|-------|\n| `fill` / `stroke` | COLOR | Binds to first solid paint |\n| `opacity` | FLOAT | 0.0–1.0 |\n| `width` / `height` | FLOAT | |\n| `cornerRadius` | FLOAT | Alias → topLeftRadius |\n| `topLeftRadius` / `topRightRadius` / `bottomLeftRadius` / `bottomRightRadius` | FLOAT | Individual corners |\n| `strokeWeight` | FLOAT | |\n| `itemSpacing` | FLOAT | Auto-layout gap |\n| `paddingTop` / `paddingBottom` / `paddingLeft` / `paddingRight` | FLOAT | |\n| `fontSize` / `letterSpacing` / `lineHeight` | FLOAT | TEXT only |\n| `fontFamily` / `fontStyle` | STRING | v2.5.4+ font swap |\n| `characters` | STRING | v2.5.4+ bind text content |\n| `visible` | BOOLEAN | Show/hide |\n\n```js\n// Complete card binding\nvar bindings = [\n  { nodeId: card.id, field: \"fill\",        varName: \"bg-surface\" },\n  { nodeId: card.id, field: \"cornerRadius\", varName: \"radius-md\" },\n  { nodeId: card.id, field: \"paddingTop\",   varName: \"spacing-md\" },\n  { nodeId: card.id, field: \"itemSpacing\",  varName: \"spacing-sm\" },\n  { nodeId: title.id, field: \"fill\",        varName: \"text-primary\" },\n];\nfor (var bi = 0; bi < bindings.length; bi++) {\n  var b = bindings[bi];\n  if (varMap[b.varName])\n    await figma.applyVariable({ nodeId: b.nodeId, field: b.field, variableId: varMap[b.varName] });\n}\n```\n\n---\n\n## Low-level Variable API\n\n```js\n// Create collection + variables + modes manually (prefer setupDesignTokens)\nvar colors = await figma.createVariableCollection({ name: \"Colors\" });\nawait figma.renameVariableMode({ collectionId: colors.id, modeId: colors.modes[0].id, newName: \"Light\" });\nvar dark = await figma.addVariableMode({ collectionId: colors.id, modeName: \"Dark\" });\n\nvar bgBase = await figma.createVariable({ name: \"bg-base\", collectionId: colors.id, resolvedType: \"COLOR\", value: \"#FFFFFF\" });\nawait figma.setVariableValue({ variableId: bgBase.id, modeId: dark.modeId, value: \"#0F1117\" });\n\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\", variableId: bgBase.id });\n\nawait figma.setFrameVariableMode({ nodeId: frame.id, collectionId: colors.id, modeName: \"Dark\" });\nawait figma.clearFrameVariableMode({ nodeId: frame.id, collectionId: colors.id });\n\nawait figma.removeVariableMode({ collectionId: colors.id, modeId: dark.modeId });\n```\n\n---\n\n## Paint & Text Styles\n\n```js\nawait figma.createPaintStyle({ name: \"color/primary\", color: \"#006FEE\", description: \"Primary brand\" });\n// → { id, name, key, color }\n\nawait figma.createTextStyle({ name: \"text/heading-xl\",\n  fontFamily: \"Inter\", fontWeight: \"Bold\", fontSize: 24, lineHeight: 32, letterSpacing: -0.5 });\n// → { id, name, key, fontSize }\n```\n\n---\n\n## ensure_library & get_library_tokens\n\n```js\nconst lib = await figma.ensure_library();\n// → { id, existed } — creates \"🎨 Design Library\" frame if not present\n\nconst tokens = await figma.get_library_tokens();\n// → { colors: [{name, hex}], textStyles: [{name, fontSize, fontWeight, fill}] }\n```\n\n---\n\n## Effects, Gradients, Corner Radii, Hex Alpha\n\n```js\n// Effects\neffects: [\n  { type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24, spread: 0 },\n  { type: \"INNER_SHADOW\", color: \"#00000030\", offset: {x:0,y:2}, radius: 4 },\n  { type: \"LAYER_BLUR\", radius: 12 },\n  { type: \"BACKGROUND_BLUR\", radius: 20 },  // needs fill with alpha < 1 (glass effect)\n]\nawait figma.modify({ id: node, effects: [] });  // clear all\n\n// Gradient fill\nfill: { type: \"LINEAR_GRADIENT\", angle: 135,\n  stops: [{ pos: 0, color: \"#7C3AED\" }, { pos: 1, color: \"#EC4899\" }] }\nfill: { type: \"RADIAL_GRADIENT\",\n  stops: [{ pos: 0, color: \"#FFFFFF\" }, { pos: 1, color: \"#00000000\" }] }\n\n// Individual corner radii\ntopLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0\n\n// Hex alpha — 8-digit hex, alpha auto-applied\nfill: \"#FFFFFF80\"    // 50% white\nfill: \"#6C5CE733\"    // 20% accent\n// Also: rgba(255,255,255,0.5)\n```\n\n---\n\n## Mixed Text Segments\n\n```js\n// get_design / get_selection returns segments for mixed-style text:\n{\n  \"type\": \"TEXT\", \"content\": \"8 đ 83 token\", \"mixedStyles\": true,\n  \"segments\": [\n    { \"text\": \"8 đ\",      \"fill\": \"#1E3150\", \"fontWeight\": \"Bold\",    \"fontSize\": 14 },\n    { \"text\": \"83 token\", \"fill\": \"#8E9AAD\", \"fontWeight\": \"Regular\", \"fontSize\": 14 }\n  ]\n}\n```\n",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma design-token documentation, including how variables and modes are handled."
        },
        "type": "noul"
      },
      "w04": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma design-token documentation\n\nThe available documentation describes the **Figma UI MCP bridge’s token API**. It supports variable collections, modes, bindings, and paint and text styles.\n\n## Create a token system\n\n`setupDesignTokens` creates or updates a collection in one call. It is **idempotent**: existing variables are updated and new ones are created.\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  colors: {\n    \"accent\": \"#3B82F6\",\n    \"bg-base\": \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n  },\n\n  numbers: {\n    \"spacing-sm\": 8,\n    \"spacing-md\": 16,\n    \"radius-md\": 12,\n  },\n\n  fontSizes: {\n    \"text-body\": 14,\n    \"text-heading-xl\": 24,\n  },\n\n  fonts: {\n    \"font-primary\": \"Inter\",\n  },\n\n  // Curly braces reference variables defined above.\n  textStyles: {\n    \"text/heading-xl\": {\n      fontFamily: \"{font-primary}\",\n      fontWeight: \"Bold\",\n      fontSize: \"{text-heading-xl}\",\n      lineHeight: 32,\n    },\n    \"text/body\": {\n      fontFamily: \"{font-primary}\",\n      fontWeight: \"Regular\",\n      fontSize: \"{text-body}\",\n      lineHeight: 20,\n    },\n  },\n});\n```\n\nThe result includes the collection ID, created and updated variables, text styles, and total variable count. Colors use `COLOR` variables; spacing, radii, and font sizes use `FLOAT`; font names use `STRING`.\n\n## Variables and modes\n\nA collection can have multiple modes, with a separate value for each variable in each mode. For example:\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\": {\n      light: \"#FFFFFF\",\n      dark: \"#0F1117\",\n    },\n    \"text-primary\": {\n      light: \"#111827\",\n      dark: \"#F9FAFB\",\n    },\n    \"accent\": {\n      light: \"#3B82F6\",\n      dark: \"#60A5FA\",\n    },\n  },\n});\n```\n\nModes can also represent other dimensions, such as typography density:\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"",
          "done_when": "The tool reply contains the tokens documentation covering variables and modes.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {
                "section": "tokens"
              },
              "reply": "\n# figma-ui-mcp — Design Tokens & Variables\n\n---\n\n## setupDesignTokens — Bootstrap complete token system (idempotent)\n\nOne call creates all variables. Existing variables get updated; new ones are created.\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  // COLOR variables\n  colors: {\n    \"accent\":       \"#3B82F6\",\n    \"bg-base\":      \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n    \"positive\":     \"#00DC82\",\n  },\n\n  // FLOAT variables (spacing, radius, etc.)\n  numbers: {\n    \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24,\n    \"radius-sm\": 8,  \"radius-md\": 12, \"radius-lg\": 16,\n  },\n\n  // FLOAT variables for typography (v2.5.4+)\n  fontSizes: {\n    \"text-xs\": 11, \"text-sm\": 12, \"text-body\": 14,\n    \"text-heading-md\": 16, \"text-heading-lg\": 20, \"text-heading-xl\": 24,\n  },\n\n  // STRING variables for fonts (v2.5.4+)\n  fonts: {\n    \"font-primary\": \"Inter\",\n    \"font-display\": \"Playfair Display\",\n  },\n\n  // Text styles that reference variables above — {curly-braces} binds to variable\n  textStyles: {\n    \"text/heading-xl\": { fontFamily: \"{font-primary}\", fontWeight: \"Bold\",\n                         fontSize: \"{text-heading-xl}\", lineHeight: 32, letterSpacing: -0.4 },\n    \"text/body\":       { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-body}\", lineHeight: 20 },\n    \"text/caption\":    { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-xs}\", lineHeight: 16 },\n  }\n});\n// → { collectionId, created: [...], updated: [...], textStyles: [...], totalVariables: N }\n\n// Multi-mode: Light + Dark\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\":      { light: \"#FFFFFF\",  dark: \"#0F1117\" },\n    \"text-primary\": { light: \"#111827\",  dark: \"#F9FAFB\" },\n    \"accent\":       { light: \"#3B82F6\",  dark: \"#60A5FA\" },\n  }\n});\n\n// Multi-mode typography: Compact / Comfortable / Large\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"],\n  fontSizes: {\n    \"text-body\":       { compact: 12, comfortable: 14, large: 16 },\n    \"text-heading-xl\": { compact: 22, comfortable: 24, large: 28 },\n  }\n});\n// Switch frame mode:\nawait figma.setFrameVariableMode({ nodeId, collectionId, modeName: \"large\" });\n```\n\n---\n\n## applyTextStyle — Apply a text style by name (v2.5.4+)\n\n```js\nvar title = await figma.create({ type: \"TEXT\", content: \"Dashboard\", parentId: card.id });\nawait figma.applyTextStyle({ nodeId: title.id, styleName: \"text/heading-xl\" });\n// → { nodeId, styleName, styleId }\n```\n\nWhy use instead of inline props: font changes propagate, mode switches work, consistent across screens.\n\n---\n\n## modifyVariable — Change variable value (all bound nodes update)\n\n```js\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\nawait figma.modifyVariable({ variableId: \"VariableID:57:671\", value: \"#FF6B35\" });\nawait figma.modifyVariable({ variableName: \"spacing-md\", value: 20 });\nawait figma.modifyVariable({ variableName: \"font-primary\", value: \"SF Pro\" }); // font swap\n```\n\n---\n\n## applyVariable — Bind a variable to a node property\n\n```js\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableId: varMap[\"accent\"] });\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableName: \"accent\" }); // by name\n```\n\n**Supported fields:**\n\n| Field | Variable type | Notes |\n|-------|--------------|-------|\n| `fill` / `stroke` | COLOR | Binds to first solid paint |\n| `opacity` | FLOAT | 0.0–1.0 |\n| `width` / `height` | FLOAT | |\n| `cornerRadius` | FLOAT | Alias → topLeftRadius |\n| `topLeftRadius` / `topRightRadius` / `bottomLeftRadius` / `bottomRightRadius` | FLOAT | Individual corners |\n| `strokeWeight` | FLOAT | |\n| `itemSpacing` | FLOAT | Auto-layout gap |\n| `paddingTop` / `paddingBottom` / `paddingLeft` / `paddingRight` | FLOAT | |\n| `fontSize` / `letterSpacing` / `lineHeight` | FLOAT | TEXT only |\n| `fontFamily` / `fontStyle` | STRING | v2.5.4+ font swap |\n| `characters` | STRING | v2.5.4+ bind text content |\n| `visible` | BOOLEAN | Show/hide |\n\n```js\n// Complete card binding\nvar bindings = [\n  { nodeId: card.id, field: \"fill\",        varName: \"bg-surface\" },\n  { nodeId: card.id, field: \"cornerRadius\", varName: \"radius-md\" },\n  { nodeId: card.id, field: \"paddingTop\",   varName: \"spacing-md\" },\n  { nodeId: card.id, field: \"itemSpacing\",  varName: \"spacing-sm\" },\n  { nodeId: title.id, field: \"fill\",        varName: \"text-primary\" },\n];\nfor (var bi = 0; bi < bindings.length; bi++) {\n  var b = bindings[bi];\n  if (varMap[b.varName])\n    await figma.applyVariable({ nodeId: b.nodeId, field: b.field, variableId: varMap[b.varName] });\n}\n```\n\n---\n\n## Low-level Variable API\n\n```js\n// Create collection + variables + modes manually (prefer setupDesignTokens)\nvar colors = await figma.createVariableCollection({ name: \"Colors\" });\nawait figma.renameVariableMode({ collectionId: colors.id, modeId: colors.modes[0].id, newName: \"Light\" });\nvar dark = await figma.addVariableMode({ collectionId: colors.id, modeName: \"Dark\" });\n\nvar bgBase = await figma.createVariable({ name: \"bg-base\", collectionId: colors.id, resolvedType: \"COLOR\", value: \"#FFFFFF\" });\nawait figma.setVariableValue({ variableId: bgBase.id, modeId: dark.modeId, value: \"#0F1117\" });\n\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\", variableId: bgBase.id });\n\nawait figma.setFrameVariableMode({ nodeId: frame.id, collectionId: colors.id, modeName: \"Dark\" });\nawait figma.clearFrameVariableMode({ nodeId: frame.id, collectionId: colors.id });\n\nawait figma.removeVariableMode({ collectionId: colors.id, modeId: dark.modeId });\n```\n\n---\n\n## Paint & Text Styles\n\n```js\nawait figma.createPaintStyle({ name: \"color/primary\", color: \"#006FEE\", description: \"Primary brand\" });\n// → { id, name, key, color }\n\nawait figma.createTextStyle({ name: \"text/heading-xl\",\n  fontFamily: \"Inter\", fontWeight: \"Bold\", fontSize: 24, lineHeight: 32, letterSpacing: -0.5 });\n// → { id, name, key, fontSize }\n```\n\n---\n\n## ensure_library & get_library_tokens\n\n```js\nconst lib = await figma.ensure_library();\n// → { id, existed } — creates \"🎨 Design Library\" frame if not present\n\nconst tokens = await figma.get_library_tokens();\n// → { colors: [{name, hex}], textStyles: [{name, fontSize, fontWeight, fill}] }\n```\n\n---\n\n## Effects, Gradients, Corner Radii, Hex Alpha\n\n```js\n// Effects\neffects: [\n  { type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24, spread: 0 },\n  { type: \"INNER_SHADOW\", color: \"#00000030\", offset: {x:0,y:2}, radius: 4 },\n  { type: \"LAYER_BLUR\", radius: 12 },\n  { type: \"BACKGROUND_BLUR\", radius: 20 },  // needs fill with alpha < 1 (glass effect)\n]\nawait figma.modify({ id: node, effects: [] });  // clear all\n\n// Gradient fill\nfill: { type: \"LINEAR_GRADIENT\", angle: 135,\n  stops: [{ pos: 0, color: \"#7C3AED\" }, { pos: 1, color: \"#EC4899\" }] }\nfill: { type: \"RADIAL_GRADIENT\",\n  stops: [{ pos: 0, color: \"#FFFFFF\" }, { pos: 1, color: \"#00000000\" }] }\n\n// Individual corner radii\ntopLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0\n\n// Hex alpha — 8-digit hex, alpha auto-applied\nfill: \"#FFFFFF80\"    // 50% white\nfill: \"#6C5CE733\"    // 20% accent\n// Also: rgba(255,255,255,0.5)\n```\n\n---\n\n## Mixed Text Segments\n\n```js\n// get_design / get_selection returns segments for mixed-style text:\n{\n  \"type\": \"TEXT\", \"content\": \"8 đ 83 token\", \"mixedStyles\": true,\n  \"segments\": [\n    { \"text\": \"8 đ\",      \"fill\": \"#1E3150\", \"fontWeight\": \"Bold\",    \"fontSize\": 14 },\n    { \"text\": \"83 token\", \"fill\": \"#8E9AAD\", \"fontWeight\": \"Regular\", \"fontSize\": 14 }\n  ]\n}\n```\n",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma design-token documentation, including how variables and modes are handled."
        },
        "type": "noul"
      },
      "w05": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Figma design tokens: variables and modes\n\nThe design-token API supports **colors, numbers, typography and font variables**, plus text styles that reference those variables. The recommended starting point is `figma.setupDesignTokens()`, which creates or updates a token collection idempotently.\n\n## Create a token system\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  // COLOR variables\n  colors: {\n    \"accent\": \"#3B82F6\",\n    \"bg-base\": \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n  },\n\n  // FLOAT variables\n  numbers: {\n    \"spacing-sm\": 8,\n    \"spacing-md\": 16,\n    \"radius-md\": 12,\n  },\n\n  // FLOAT variables for typography\n  fontSizes: {\n    \"text-body\": 14,\n    \"text-heading\": 24,\n  },\n\n  // STRING variables\n  fonts: {\n    \"font-primary\": \"Inter\",\n  },\n\n  // Curly braces reference variables above\n  textStyles: {\n    \"text/heading\": {\n      fontFamily: \"{font-primary}\",\n      fontWeight: \"Bold\",\n      fontSize: \"{text-heading}\",\n      lineHeight: 32,\n    },\n    \"text/body\": {\n      fontFamily: \"{font-primary}\",\n      fontWeight: \"Regular\",\n      fontSize: \"{text-body}\",\n      lineHeight: 20,\n    },\n  },\n});\n```\n\nThe result includes the collection ID, created and updated variables, text styles, and total variable count.\n\n## Modes\n\nA collection can define multiple modes, with a value for each mode. For example:\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\": {\n      light: \"#FFFFFF\",\n      dark: \"#0F1117\",\n    },\n    \"text-primary\": {\n      light: \"#111827\",\n      dark: \"#F9FAFB\",\n    },\n    \"accent\": {\n      light: \"#3B82F6\",\n      dark: \"#60A5FA\",\n    },\n  },\n});\n```\n\nModes can also control numeric values, such as typography sizes:\n\n```js\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"],\n  fontSizes: {\n    \"text-body\": { compact: 12, comfortable: 14, large: 16 },\n  },\n});\n\n// Set a coll",
          "done_when": "The tool reply contains the tokens documentation covering variables and modes.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            },
            {
              "arguments": {
                "section": "tokens"
              },
              "reply": "\n# figma-ui-mcp — Design Tokens & Variables\n\n---\n\n## setupDesignTokens — Bootstrap complete token system (idempotent)\n\nOne call creates all variables. Existing variables get updated; new ones are created.\n\n```js\nconst result = await figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n\n  // COLOR variables\n  colors: {\n    \"accent\":       \"#3B82F6\",\n    \"bg-base\":      \"#08090E\",\n    \"text-primary\": \"#F0F2F5\",\n    \"positive\":     \"#00DC82\",\n  },\n\n  // FLOAT variables (spacing, radius, etc.)\n  numbers: {\n    \"spacing-xs\": 4, \"spacing-sm\": 8, \"spacing-md\": 16, \"spacing-lg\": 24,\n    \"radius-sm\": 8,  \"radius-md\": 12, \"radius-lg\": 16,\n  },\n\n  // FLOAT variables for typography (v2.5.4+)\n  fontSizes: {\n    \"text-xs\": 11, \"text-sm\": 12, \"text-body\": 14,\n    \"text-heading-md\": 16, \"text-heading-lg\": 20, \"text-heading-xl\": 24,\n  },\n\n  // STRING variables for fonts (v2.5.4+)\n  fonts: {\n    \"font-primary\": \"Inter\",\n    \"font-display\": \"Playfair Display\",\n  },\n\n  // Text styles that reference variables above — {curly-braces} binds to variable\n  textStyles: {\n    \"text/heading-xl\": { fontFamily: \"{font-primary}\", fontWeight: \"Bold\",\n                         fontSize: \"{text-heading-xl}\", lineHeight: 32, letterSpacing: -0.4 },\n    \"text/body\":       { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-body}\", lineHeight: 20 },\n    \"text/caption\":    { fontFamily: \"{font-primary}\", fontWeight: \"Regular\",\n                         fontSize: \"{text-xs}\", lineHeight: 16 },\n  }\n});\n// → { collectionId, created: [...], updated: [...], textStyles: [...], totalVariables: N }\n\n// Multi-mode: Light + Dark\nawait figma.setupDesignTokens({\n  collectionName: \"Design Tokens\",\n  modes: [\"light\", \"dark\"],\n  colors: {\n    \"bg-base\":      { light: \"#FFFFFF\",  dark: \"#0F1117\" },\n    \"text-primary\": { light: \"#111827\",  dark: \"#F9FAFB\" },\n    \"accent\":       { light: \"#3B82F6\",  dark: \"#60A5FA\" },\n  }\n});\n\n// Multi-mode typography: Compact / Comfortable / Large\nawait figma.setupDesignTokens({\n  collectionName: \"Typography\",\n  modes: [\"compact\", \"comfortable\", \"large\"],\n  fontSizes: {\n    \"text-body\":       { compact: 12, comfortable: 14, large: 16 },\n    \"text-heading-xl\": { compact: 22, comfortable: 24, large: 28 },\n  }\n});\n// Switch frame mode:\nawait figma.setFrameVariableMode({ nodeId, collectionId, modeName: \"large\" });\n```\n\n---\n\n## applyTextStyle — Apply a text style by name (v2.5.4+)\n\n```js\nvar title = await figma.create({ type: \"TEXT\", content: \"Dashboard\", parentId: card.id });\nawait figma.applyTextStyle({ nodeId: title.id, styleName: \"text/heading-xl\" });\n// → { nodeId, styleName, styleId }\n```\n\nWhy use instead of inline props: font changes propagate, mode switches work, consistent across screens.\n\n---\n\n## modifyVariable — Change variable value (all bound nodes update)\n\n```js\nawait figma.modifyVariable({ variableName: \"accent\", value: \"#0EA5E9\" });\nawait figma.modifyVariable({ variableId: \"VariableID:57:671\", value: \"#FF6B35\" });\nawait figma.modifyVariable({ variableName: \"spacing-md\", value: 20 });\nawait figma.modifyVariable({ variableName: \"font-primary\", value: \"SF Pro\" }); // font swap\n```\n\n---\n\n## applyVariable — Bind a variable to a node property\n\n```js\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableId: varMap[\"accent\"] });\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\",         variableName: \"accent\" }); // by name\n```\n\n**Supported fields:**\n\n| Field | Variable type | Notes |\n|-------|--------------|-------|\n| `fill` / `stroke` | COLOR | Binds to first solid paint |\n| `opacity` | FLOAT | 0.0–1.0 |\n| `width` / `height` | FLOAT | |\n| `cornerRadius` | FLOAT | Alias → topLeftRadius |\n| `topLeftRadius` / `topRightRadius` / `bottomLeftRadius` / `bottomRightRadius` | FLOAT | Individual corners |\n| `strokeWeight` | FLOAT | |\n| `itemSpacing` | FLOAT | Auto-layout gap |\n| `paddingTop` / `paddingBottom` / `paddingLeft` / `paddingRight` | FLOAT | |\n| `fontSize` / `letterSpacing` / `lineHeight` | FLOAT | TEXT only |\n| `fontFamily` / `fontStyle` | STRING | v2.5.4+ font swap |\n| `characters` | STRING | v2.5.4+ bind text content |\n| `visible` | BOOLEAN | Show/hide |\n\n```js\n// Complete card binding\nvar bindings = [\n  { nodeId: card.id, field: \"fill\",        varName: \"bg-surface\" },\n  { nodeId: card.id, field: \"cornerRadius\", varName: \"radius-md\" },\n  { nodeId: card.id, field: \"paddingTop\",   varName: \"spacing-md\" },\n  { nodeId: card.id, field: \"itemSpacing\",  varName: \"spacing-sm\" },\n  { nodeId: title.id, field: \"fill\",        varName: \"text-primary\" },\n];\nfor (var bi = 0; bi < bindings.length; bi++) {\n  var b = bindings[bi];\n  if (varMap[b.varName])\n    await figma.applyVariable({ nodeId: b.nodeId, field: b.field, variableId: varMap[b.varName] });\n}\n```\n\n---\n\n## Low-level Variable API\n\n```js\n// Create collection + variables + modes manually (prefer setupDesignTokens)\nvar colors = await figma.createVariableCollection({ name: \"Colors\" });\nawait figma.renameVariableMode({ collectionId: colors.id, modeId: colors.modes[0].id, newName: \"Light\" });\nvar dark = await figma.addVariableMode({ collectionId: colors.id, modeName: \"Dark\" });\n\nvar bgBase = await figma.createVariable({ name: \"bg-base\", collectionId: colors.id, resolvedType: \"COLOR\", value: \"#FFFFFF\" });\nawait figma.setVariableValue({ variableId: bgBase.id, modeId: dark.modeId, value: \"#0F1117\" });\n\nawait figma.applyVariable({ nodeId: card.id, field: \"fill\", variableId: bgBase.id });\n\nawait figma.setFrameVariableMode({ nodeId: frame.id, collectionId: colors.id, modeName: \"Dark\" });\nawait figma.clearFrameVariableMode({ nodeId: frame.id, collectionId: colors.id });\n\nawait figma.removeVariableMode({ collectionId: colors.id, modeId: dark.modeId });\n```\n\n---\n\n## Paint & Text Styles\n\n```js\nawait figma.createPaintStyle({ name: \"color/primary\", color: \"#006FEE\", description: \"Primary brand\" });\n// → { id, name, key, color }\n\nawait figma.createTextStyle({ name: \"text/heading-xl\",\n  fontFamily: \"Inter\", fontWeight: \"Bold\", fontSize: 24, lineHeight: 32, letterSpacing: -0.5 });\n// → { id, name, key, fontSize }\n```\n\n---\n\n## ensure_library & get_library_tokens\n\n```js\nconst lib = await figma.ensure_library();\n// → { id, existed } — creates \"🎨 Design Library\" frame if not present\n\nconst tokens = await figma.get_library_tokens();\n// → { colors: [{name, hex}], textStyles: [{name, fontSize, fontWeight, fill}] }\n```\n\n---\n\n## Effects, Gradients, Corner Radii, Hex Alpha\n\n```js\n// Effects\neffects: [\n  { type: \"DROP_SHADOW\", color: \"#00000026\", offset: {x:0,y:8}, radius: 24, spread: 0 },\n  { type: \"INNER_SHADOW\", color: \"#00000030\", offset: {x:0,y:2}, radius: 4 },\n  { type: \"LAYER_BLUR\", radius: 12 },\n  { type: \"BACKGROUND_BLUR\", radius: 20 },  // needs fill with alpha < 1 (glass effect)\n]\nawait figma.modify({ id: node, effects: [] });  // clear all\n\n// Gradient fill\nfill: { type: \"LINEAR_GRADIENT\", angle: 135,\n  stops: [{ pos: 0, color: \"#7C3AED\" }, { pos: 1, color: \"#EC4899\" }] }\nfill: { type: \"RADIAL_GRADIENT\",\n  stops: [{ pos: 0, color: \"#FFFFFF\" }, { pos: 1, color: \"#00000000\" }] }\n\n// Individual corner radii\ntopLeftRadius: 20, topRightRadius: 20, bottomLeftRadius: 0, bottomRightRadius: 0\n\n// Hex alpha — 8-digit hex, alpha auto-applied\nfill: \"#FFFFFF80\"    // 50% white\nfill: \"#6C5CE733\"    // 20% accent\n// Also: rgba(255,255,255,0.5)\n```\n\n---\n\n## Mixed Text Segments\n\n```js\n// get_design / get_selection returns segments for mixed-style text:\n{\n  \"type\": \"TEXT\", \"content\": \"8 đ 83 token\", \"mixedStyles\": true,\n  \"segments\": [\n    { \"text\": \"8 đ\",      \"fill\": \"#1E3150\", \"fontWeight\": \"Bold\",    \"fontSize\": 14 },\n    { \"text\": \"83 token\", \"fill\": \"#8E9AAD\", \"fontWeight\": \"Regular\", \"fontSize\": 14 }\n  ]\n}\n```\n",
              "tool": "figma_docs"
            }
          ],
          "task": "Show me the Figma design-token documentation, including how variables and modes are handled."
        },
        "type": "noul"
      },
      "w06": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The Figma plugin bridge is **not connected**. The bridge is running in direct mode on port 38451, but no plugin session is active.\n\nTo connect it in Figma Desktop, go to **Plugins → Development → Figma UI MCP Bridge → Run**.",
          "done_when": "The tool reply reports the bridge connection status.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            }
          ],
          "task": "Check whether the Figma plugin bridge is connected and report its status."
        },
        "type": "noul"
      },
      "w07": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The Figma plugin bridge is **not connected**. The bridge is running in direct mode on port 38451, but no plugin sessions are active.\n\nTo connect it in Figma Desktop, select **Plugins → Development → Figma UI MCP Bridge → Run**.",
          "done_when": "The tool reply reports the bridge connection status.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            }
          ],
          "task": "Check whether the Figma plugin bridge is connected and report its status."
        },
        "type": "noul"
      },
      "w08": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The Figma plugin bridge is **not connected**. The bridge is running in direct mode on port 38451, but no plugin session is active.\n\nTo connect it in Figma Desktop, go to **Plugins → Development → Figma UI MCP Bridge → Run**.",
          "done_when": "The tool reply reports the bridge connection status.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {},
              "reply": "{\n  \"bridgePort\": 38451,\n  \"pluginConnected\": false,\n  \"pluginInfo\": null,\n  \"mode\": \"direct\",\n  \"queueLength\": 0,\n  \"lastPollAgoMs\": null,\n  \"stats\": {\n    \"ops\": 0,\n    \"avgLatencyMs\": 0,\n    \"reconnects\": 0,\n    \"sessions\": 0\n  },\n  \"sessions\": [],\n  \"hint\": \"Plugin not connected. In Figma Desktop: Plugins → Development → Figma UI MCP Bridge → Run\"\n}",
              "tool": "figma_status"
            }
          ],
          "task": "Check whether the Figma plugin bridge is connected and report its status."
        },
        "type": "noul"
      }
    },
    "state": {
      "about": "Replies of an MCP server to tool calls that were sent with bad input on purpose, to see whether its error messages help a caller fix the call."
    }
  },
  "run_id": "01M83ET01NSC3WMYB2JXB9QY09",
  "works_done": [
    {
      "attempt": 0,
      "noul": 0.69,
      "question": "w00"
    },
    {
      "attempt": 1,
      "noul": 0.72,
      "question": "w01"
    },
    {
      "attempt": 2,
      "noul": 0.95,
      "question": "w02"
    },
    {
      "attempt": 3,
      "noul": 0.96,
      "question": "w03"
    },
    {
      "attempt": 4,
      "noul": 0.97,
      "question": "w04"
    },
    {
      "attempt": 5,
      "noul": 0.97,
      "question": "w05"
    },
    {
      "attempt": 6,
      "noul": 0.98,
      "question": "w06"
    },
    {
      "attempt": 7,
      "noul": 0.98,
      "question": "w07"
    },
    {
      "attempt": 8,
      "noul": 0.98,
      "question": "w08"
    }
  ]
}
