@ufira/vibma 0.3.2 → 1.0.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/mcp.cjs +2455 -1159
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.js +2457 -1161
- package/dist/mcp.js.map +1 -1
- package/dist/tools/endpoint.cjs +10 -1
- package/dist/tools/endpoint.cjs.map +1 -1
- package/dist/tools/endpoint.js +10 -1
- package/dist/tools/endpoint.js.map +1 -1
- package/dist/tools/generated/guards.cjs +786 -0
- package/dist/tools/generated/guards.cjs.map +1 -0
- package/dist/tools/generated/guards.d.cts +92 -0
- package/dist/tools/generated/guards.d.ts +92 -0
- package/dist/tools/generated/guards.js +718 -0
- package/dist/tools/generated/guards.js.map +1 -0
- package/dist/tools/registry.cjs +946 -2
- package/dist/tools/registry.cjs.map +1 -1
- package/dist/tools/registry.js +948 -2
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/schemas.cjs +43 -6
- package/dist/tools/schemas.cjs.map +1 -1
- package/dist/tools/schemas.d.cts +38 -6
- package/dist/tools/schemas.d.ts +38 -6
- package/dist/tools/schemas.js +38 -6
- package/dist/tools/schemas.js.map +1 -1
- package/dist/tools/types.cjs.map +1 -1
- package/dist/tools/types.d.cts +5 -1
- package/dist/tools/types.d.ts +5 -1
- package/dist/tools/types.js.map +1 -1
- package/package.json +6 -2
package/dist/mcp.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mcp.ts","../src/tools/types.ts","../src/tools/registry.ts","../src/tools/defs/connection.ts","../src/tools/defs/document.ts","../src/tools/defs/selection.ts","../src/utils/coercion.ts","../src/tools/defs/node-info.ts","../src/tools/defs/create-shape.ts","../src/tools/schemas.ts","../src/tools/defs/create-frame.ts","../src/tools/defs/create-text.ts","../src/tools/defs/modify-node.ts","../src/tools/defs/patch-nodes.ts","../src/tools/defs/text.ts","../src/tools/defs/fonts.ts","../src/tools/defs/lint.ts","../src/tools/defs/styles.ts","../src/tools/endpoint.ts","../src/tools/defs/variables.ts","../src/tools/defs/components.ts","../src/tools/prompts.ts","../src/tools/mcp-registry.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\nimport WebSocket from \"ws\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { readFileSync } from \"fs\";\nimport { join, basename } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { registerAllTools } from \"./tools/mcp-registry\";\n\n// Read version — works with both tsx (source) and node (compiled dist/)\nlet VIBMA_VERSION = \"0.0.0\";\ntry {\n // Walk up from current file's dir to find package.json\n // Use import.meta.url (works in ESM), __dirname (works in CJS), process.cwd() as last resort\n const start = typeof import.meta?.url !== \"undefined\"\n ? join(fileURLToPath(import.meta.url), \"..\")\n : typeof __dirname !== \"undefined\" ? __dirname : process.cwd();\n for (let dir = start; dir !== \"/\"; dir = join(dir, \"..\")) {\n try {\n const pkg = JSON.parse(readFileSync(join(dir, \"package.json\"), \"utf8\"));\n if (pkg.name === \"@ufira/vibma\") { VIBMA_VERSION = pkg.version; break; }\n // Workspace root — dist/ is at root level, read core package version\n if (pkg.workspaces) {\n try { VIBMA_VERSION = JSON.parse(readFileSync(join(dir, \"packages/core/package.json\"), \"utf8\")).version; } catch {}\n break;\n }\n } catch { continue; }\n }\n} catch { /* fallback */ }\n\n// ─── Logger (stderr so it doesn't pollute MCP stdio) ────────────\nconst logger = {\n info: (msg: string) => process.stderr.write(`[INFO] ${msg}\\n`),\n debug: (msg: string) => process.stderr.write(`[DEBUG] ${msg}\\n`),\n warn: (msg: string) => process.stderr.write(`[WARN] ${msg}\\n`),\n error: (msg: string) => process.stderr.write(`[ERROR] ${msg}\\n`),\n log: (msg: string) => process.stderr.write(`[LOG] ${msg}\\n`),\n};\n\n// ─── Types ───────────────────────────────────────────────────────\n\ninterface FigmaResponse {\n id: string;\n result?: any;\n error?: string;\n}\n\ninterface CommandProgressUpdate {\n type: \"command_progress\";\n commandId: string;\n commandType: string;\n status: \"started\" | \"in_progress\" | \"completed\" | \"error\";\n progress: number;\n totalItems: number;\n processedItems: number;\n currentChunk?: number;\n totalChunks?: number;\n chunkSize?: number;\n message: string;\n payload?: any;\n timestamp: number;\n}\n\n// ─── WebSocket state ─────────────────────────────────────────────\n\nlet ws: WebSocket | null = null;\nconst pendingRequests = new Map<\n string,\n {\n resolve: (value: unknown) => void;\n reject: (reason: unknown) => void;\n timeout: ReturnType<typeof setTimeout>;\n lastActivity: number;\n }\n>();\nlet currentChannel: string | null = null;\nlet activePort: number = parseInt(process.env.VIBMA_PORT || \"3055\");\nlet rejected = false; // Suppress auto-reconnect after ROLE_OCCUPIED rejection\nlet versionWarning: string | null = null;\n\n// CLI args\nconst args = process.argv.slice(2);\nconst serverArg = args.find((a) => a.startsWith(\"--server=\"));\nconst portArg = args.find((a) => a.startsWith(\"--port=\"));\nconst serverUrl = serverArg ? serverArg.split(\"=\")[1] : \"localhost\";\nif (portArg) activePort = parseInt(portArg.split(\"=\")[1]);\nconst WS_URL = serverUrl === \"localhost\" ? `ws://${serverUrl}` : `wss://${serverUrl}`;\n\n// Access-tier flags: read is always on, --create / --edit opt-in\nconst caps = {\n create: args.includes(\"--create\") || args.includes(\"--edit\"),\n edit: args.includes(\"--edit\"),\n};\n\n// ─── WebSocket connection ────────────────────────────────────────\n\nfunction connectToFigma(port: number = activePort) {\n activePort = port;\n if (ws && ws.readyState === WebSocket.OPEN) {\n logger.info(\"Already connected to Figma\");\n return;\n }\n\n const wsUrl = serverUrl === \"localhost\" ? `${WS_URL}:${port}` : WS_URL;\n logger.info(`Connecting to Figma socket server at ${wsUrl}...`);\n ws = new WebSocket(wsUrl);\n\n ws.on(\"open\", () => {\n logger.info(\"Connected to Figma socket server\");\n currentChannel = null;\n });\n\n ws.on(\"message\", (data: any) => {\n try {\n const json = JSON.parse(data) as any;\n\n // Handle same-client rejoin (already in channel)\n if (json.type === \"join-success\") {\n logger.info(json.message);\n if (json.id && pendingRequests.has(json.id)) {\n const req = pendingRequests.get(json.id)!;\n clearTimeout(req.timeout);\n req.resolve({ status: \"already_joined\", channel: json.channel });\n pendingRequests.delete(json.id);\n }\n return;\n }\n\n // Handle system messages with a code (version mismatch, peer join/leave)\n // Note: join-success also uses type=system but carries message.id + message.result — let those fall through\n if (json.type === \"system\" && json.code) {\n if (json.code === \"VERSION_MISMATCH\") {\n versionWarning = json.message;\n logger.warn(`Version mismatch: ${json.message}`);\n }\n return;\n }\n\n // Handle relay errors (e.g., ROLE_OCCUPIED rejection)\n if (json.type === \"error\") {\n logger.error(`Relay error: ${json.message}`);\n if (json.code === \"ROLE_OCCUPIED\") rejected = true;\n if (json.id && pendingRequests.has(json.id)) {\n const req = pendingRequests.get(json.id)!;\n clearTimeout(req.timeout);\n req.reject(new Error(json.message));\n pendingRequests.delete(json.id);\n }\n return;\n }\n\n // Handle progress updates\n if (json.type === \"progress_update\") {\n const progressData = json.message.data as CommandProgressUpdate;\n const requestId = json.id || \"\";\n\n if (requestId && pendingRequests.has(requestId)) {\n const request = pendingRequests.get(requestId)!;\n request.lastActivity = Date.now();\n clearTimeout(request.timeout);\n request.timeout = setTimeout(() => {\n if (pendingRequests.has(requestId)) {\n logger.error(`Request ${requestId} timed out after extended period of inactivity`);\n pendingRequests.delete(requestId);\n request.reject(new Error(\"Request to Figma timed out\"));\n }\n }, 60000);\n logger.info(`Progress update for ${progressData.commandType}: ${progressData.progress}% - ${progressData.message}`);\n if (progressData.status === \"completed\" && progressData.progress === 100) {\n logger.info(`Operation ${progressData.commandType} completed, waiting for final result`);\n }\n }\n return;\n }\n\n // Handle regular responses\n const myResponse = json.message;\n logger.debug(`Received message: ${JSON.stringify(myResponse)}`);\n\n if (myResponse.id && pendingRequests.has(myResponse.id) && myResponse.result) {\n const request = pendingRequests.get(myResponse.id)!;\n clearTimeout(request.timeout);\n if (myResponse.error) {\n logger.error(`Error from Figma: ${myResponse.error}`);\n request.reject(new Error(myResponse.error));\n } else {\n request.resolve(myResponse.result);\n }\n pendingRequests.delete(myResponse.id);\n } else {\n logger.info(`Received broadcast message: ${JSON.stringify(myResponse)}`);\n }\n } catch (error) {\n logger.error(`Error parsing message: ${error instanceof Error ? error.message : String(error)}`);\n }\n });\n\n ws.on(\"error\", (error) => {\n logger.error(`Socket error: ${error}`);\n });\n\n ws.on(\"close\", () => {\n logger.info(\"Disconnected from Figma socket server\");\n ws = null;\n for (const [id, request] of pendingRequests.entries()) {\n clearTimeout(request.timeout);\n request.reject(new Error(\"Connection closed\"));\n pendingRequests.delete(id);\n }\n if (rejected) {\n logger.info(\"Not reconnecting — channel role was rejected. Call join_channel to retry.\");\n } else {\n logger.info(\"Attempting to reconnect in 2 seconds...\");\n setTimeout(() => connectToFigma(port), 2000);\n }\n });\n}\n\n// ─── Channel management ──────────────────────────────────────────\n\nasync function joinChannel(channelName: string): Promise<void> {\n rejected = false; // Reset rejection state on explicit join attempt\n versionWarning = null;\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n connectToFigma();\n // Wait briefly for connection\n await new Promise((resolve) => setTimeout(resolve, 1000));\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"Not connected to relay. Check that the relay server is running.\");\n }\n }\n try {\n await sendCommandToFigma(\"join\", { channel: channelName });\n currentChannel = channelName;\n logger.info(`Joined channel: ${channelName}`);\n } catch (error) {\n logger.error(`Failed to join channel: ${error instanceof Error ? error.message : String(error)}`);\n throw error;\n }\n}\n\n// ─── Send command to Figma ───────────────────────────────────────\n\nfunction sendCommandToFigma(\n command: string,\n params: unknown = {},\n timeoutMs: number = 30000\n): Promise<unknown> {\n return new Promise((resolve, reject) => {\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n connectToFigma();\n reject(new Error(\"Not connected to Figma. Attempting to connect...\"));\n return;\n }\n\n const requiresChannel = command !== \"join\";\n if (requiresChannel && !currentChannel) {\n reject(new Error(\"No channel joined. Call join_channel first with the channel name shown in the Figma plugin panel.\"));\n return;\n }\n\n const id = uuidv4();\n const request = {\n id,\n type: command === \"join\" ? \"join\" : \"message\",\n ...(command === \"join\"\n ? { channel: (params as any).channel, role: \"mcp\", version: VIBMA_VERSION, name: basename(process.cwd()) }\n : { channel: currentChannel }),\n message: {\n id,\n command,\n params: {\n ...(params as any),\n commandId: id,\n },\n },\n };\n\n const timeout = setTimeout(() => {\n if (pendingRequests.has(id)) {\n pendingRequests.delete(id);\n logger.error(`Request ${id} to Figma timed out after ${timeoutMs / 1000} seconds`);\n reject(new Error(\n `Request to Figma timed out. This usually means the Figma plugin is not connected to the relay. ` +\n `MCP is using port ${activePort}, channel \"${currentChannel}\". ` +\n `Check the Figma plugin window: the port and channel name must match.`\n ));\n }\n }, timeoutMs);\n\n pendingRequests.set(id, { resolve, reject, timeout, lastActivity: Date.now() });\n logger.info(`Sending command to Figma: ${command}`);\n logger.debug(`Request details: ${JSON.stringify(request)}`);\n ws.send(JSON.stringify(request));\n });\n}\n\n// ─── MCP Server bootstrap ────────────────────────────────────────\n\nconst server = new McpServer({\n name: \"VibmaMCP\",\n version: \"1.0.0\",\n});\n\n// Register the join_channel tool directly (it uses local state)\nserver.registerTool(\n \"join_channel\",\n {\n description: \"REQUIRED FIRST STEP: Join a channel before using any other tool. The channel name is shown in the Figma plugin UI (defaults to 'vibma' if not customised). After joining, call `ping` to verify the Figma plugin is connected. All subsequent commands are sent through this channel.\",\n inputSchema: { channel: z.string().describe(\"The channel name displayed in the Figma plugin panel. Defaults to 'vibma' if omitted.\").default(\"vibma\") },\n },\n async ({ channel }: any) => {\n try {\n await joinChannel(channel);\n // Brief wait for VERSION_MISMATCH system message from relay\n await new Promise((r) => setTimeout(r, 200));\n let msg = `Joined channel \"${channel}\" on port ${activePort}. Call \\`ping\\` now to verify the Figma plugin is connected.`;\n if (versionWarning) msg += `\\n\\n⚠️ ${versionWarning}\\nSee \"Version mismatch\" in CARRYME.md or DRAGME.md for update steps.`;\n return {\n content: [{ type: \"text\", text: msg }],\n };\n } catch (error) {\n return {\n content: [{\n type: \"text\",\n text: `Error joining channel: ${error instanceof Error ? error.message : String(error)}. MCP is using port ${activePort} — confirm the relay is running on the same port.`,\n }],\n };\n }\n }\n);\n\n// Debug tool: inspect relay channel occupancy\nserver.registerTool(\n \"channel_info\",\n {\n description: \"Debug: inspect which clients (MCP, plugin) are connected to each relay channel. Useful for diagnosing connection issues. Does not require an active channel.\",\n },\n async () => {\n try {\n const url = serverUrl === \"localhost\"\n ? `http://localhost:${activePort}/channels`\n : `https://${serverUrl}/channels`;\n const response = await fetch(url);\n if (!response.ok) {\n return { content: [{ type: \"text\", text: `Relay returned ${response.status}: ${await response.text()}` }] };\n }\n const data = await response.json();\n return { content: [{ type: \"text\", text: JSON.stringify(data, null, 2) }] };\n } catch (error) {\n return {\n content: [{\n type: \"text\",\n text: `Could not reach relay at port ${activePort}: ${error instanceof Error ? error.message : String(error)}`,\n }],\n };\n }\n }\n);\n\n// Factory-reset the tunnel — clears channel on relay via HTTP, then reconnects\nserver.registerTool(\n \"reset_tunnel\",\n {\n description: \"DESTRUCTIVE: Factory-reset a channel on the relay via HTTP, disconnecting ALL occupants (MCP + Figma plugin). Only use this when the channel is stuck or occupied by another MCP — do NOT use it just to reconnect yourself (use `join_channel` instead). After reset, ask the user to reopen the Vibma plugin in Figma, then call `join_channel` and `ping`.\",\n inputSchema: {\n channel: z.string().describe(\"Channel to reset. Defaults to 'vibma'.\").default(\"vibma\"),\n },\n },\n async ({ channel }: { channel: string }) => {\n const targetChannel = channel || currentChannel || \"vibma\";\n try {\n // Factory reset the channel via HTTP — works regardless of socket state\n const url = serverUrl === \"localhost\"\n ? `http://localhost:${activePort}/channels/${encodeURIComponent(targetChannel)}`\n : `https://${serverUrl}/channels/${encodeURIComponent(targetChannel)}`;\n const res = await fetch(url, { method: \"DELETE\" });\n const body = await res.json() as { ok: boolean; message: string };\n\n // Reject all pending requests\n for (const [reqId, request] of pendingRequests.entries()) {\n clearTimeout(request.timeout);\n request.reject(new Error(\"Tunnel reset by user\"));\n pendingRequests.delete(reqId);\n }\n\n // Close the local WebSocket\n if (ws) {\n const old = ws;\n ws = null;\n old.removeAllListeners();\n old.close(1000, \"Tunnel reset\");\n }\n currentChannel = null;\n rejected = false;\n\n // Reconnect to relay\n connectToFigma();\n await new Promise((resolve) => setTimeout(resolve, 1000));\n const connected = ws && ws.readyState === WebSocket.OPEN;\n\n return {\n content: [{\n type: \"text\",\n text: connected\n ? `Tunnel reset: ${body.message}. Reconnected on port ${activePort}.\\n\\nIMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin in Figma (or click \"Reset tunnel\" in the plugin panel). Then call \\`join_channel\\` followed by \\`ping\\`.`\n : `Tunnel reset: ${body.message}. Reconnection in progress.\\n\\nIMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin in Figma (or click \"Reset tunnel\" in the plugin panel). Then call \\`join_channel\\` to retry.`,\n }],\n };\n } catch (error) {\n return {\n content: [{\n type: \"text\",\n text: `Error resetting tunnel: ${error instanceof Error ? error.message : String(error)}`,\n }],\n };\n }\n }\n);\n\n// Register all per-tool-file tools and prompts\nregisterAllTools(server, sendCommandToFigma, caps);\n\n// ─── Start ───────────────────────────────────────────────────────\n\nfunction cleanup() {\n if (ws && ws.readyState === WebSocket.OPEN) {\n ws.close(1000, \"MCP server shutting down\");\n }\n}\n\nprocess.on(\"SIGINT\", () => { cleanup(); process.exit(0); });\nprocess.on(\"SIGTERM\", () => { cleanup(); process.exit(0); });\nprocess.on(\"exit\", cleanup);\nprocess.stdin.on(\"end\", () => { cleanup(); process.exit(0); });\n\nasync function main() {\n try {\n connectToFigma();\n } catch (error) {\n logger.warn(`Could not connect to Figma initially: ${error instanceof Error ? error.message : String(error)}`);\n logger.warn(\"Will try to connect when the first command is sent\");\n }\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n logger.info(\"FigmaMCP server running on stdio\");\n}\n\nmain().catch((error) => {\n logger.error(`Error starting FigmaMCP server: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type { z } from \"zod\";\n\n/** Function signature for sending commands to Figma via WebSocket */\nexport type SendCommandFn = (command: string, params?: unknown, timeoutMs?: number) => Promise<unknown>;\n\n/** Re-export McpServer type for tool files */\nexport type { McpServer };\n\n// ─── Tool Registry Types ────────────────────────────────────────\n\n/** Access tier for a tool */\nexport type ToolTier = \"read\" | \"create\" | \"edit\";\n\n/** Which tiers are enabled for this MCP session */\nexport interface Capabilities { create: boolean; edit: boolean }\n\n/** Declarative tool definition — replaces imperative registerMcpTools() */\nexport interface ToolDef {\n name: string;\n description: string;\n schema: Record<string, z.ZodTypeAny>\n | ((caps: Capabilities) => Record<string, z.ZodTypeAny>);\n tier: ToolTier;\n /** Figma command name. Defaults to name. */\n command?: string;\n /** sendCommand timeout in ms (default: 30 000) */\n timeout?: number;\n /** Pre-send validation (e.g. per-method item parsing for endpoints) */\n validate?: (params: any) => void;\n /** Custom response formatter. Default: mcpJson */\n formatResponse?: (result: unknown) => any;\n}\n\n/** Standard batch result from Figma handlers */\nexport interface BatchResult<T = unknown> {\n results: Array<T | \"ok\" | { error: string }>;\n warnings?: string[];\n /** Set when some items were deferred (e.g. font loading cap exceeded) */\n deferred?: string;\n}\n\n/** Max response size in characters (~12K tokens). Prevents LLM client-side truncation that corrupts JSON. */\nconst MAX_RESPONSE_CHARS = 50_000;\n\n/** Format a successful MCP response (JSON). Returns a clean error if response exceeds safe size. */\nexport function mcpJson(data: unknown) {\n const text = JSON.stringify(data);\n if (text.length <= MAX_RESPONSE_CHARS) {\n return { content: [{ type: \"text\" as const, text }] };\n }\n return {\n content: [{\n type: \"text\" as const,\n text: JSON.stringify({\n _error: \"response_too_large\",\n _sizeKB: Math.round(text.length / 1024),\n warning: \"Response exceeds safe size. Use 'depth', 'fields', 'limit', or 'summaryOnly' parameters to reduce response size.\",\n }),\n }],\n };\n}\n\n/** Format an error MCP response */\nexport function mcpError(prefix: string, error: unknown) {\n const msg = error instanceof Error ? error.message : String(error);\n return { content: [{ type: \"text\" as const, text: `${prefix}: ${msg}` }] };\n}\n","import type { McpServer, SendCommandFn, Capabilities, ToolDef } from \"./types\";\nimport { mcpJson, mcpError } from \"./types\";\n\n/**\n * Batch-register declarative ToolDefs on the MCP server.\n *\n * 1. Filters by tier: read → always, create → caps.create, edit → caps.edit\n * 2. Resolves dynamic schemas (endpoint tools pass caps-dependent functions)\n * 3. Generates a uniform handler: validate? → sendCommand → formatResponse ?? mcpJson\n */\nexport function registerTools(\n server: McpServer,\n sendCommand: SendCommandFn,\n caps: Capabilities,\n tools: ToolDef[],\n): void {\n for (const tool of tools) {\n // Tier gate\n if (tool.tier === \"create\" && !caps.create) continue;\n if (tool.tier === \"edit\" && !caps.edit) continue;\n\n const schema = typeof tool.schema === \"function\" ? tool.schema(caps) : tool.schema;\n const command = tool.command ?? tool.name;\n const timeout = tool.timeout;\n const format = tool.formatResponse ?? mcpJson;\n\n server.registerTool(tool.name, { description: tool.description, inputSchema: schema }, async (params: any) => {\n try {\n if (tool.validate) tool.validate(params);\n const result = await sendCommand(command, params, timeout);\n return format(result);\n } catch (e) {\n return mcpError(`${tool.name} error`, e);\n }\n });\n }\n}\n","import type { ToolDef } from \"../types\";\n\nexport const tools: ToolDef[] = [\n {\n name: \"ping\",\n description: \"Verify end-to-end connection to Figma. Call this right after join_channel. Returns { status: 'pong', documentName, currentPage } if the full chain (MCP → relay → plugin → Figma) is working. If this times out, the Figma plugin is not connected — ask the user to check the plugin window for the correct port and channel name.\",\n schema: {},\n tier: \"read\",\n timeout: 5000,\n },\n];\n","import { z } from \"zod\";\nimport type { ToolDef } from \"../types\";\n\nexport const tools: ToolDef[] = [\n {\n name: \"get_document_info\",\n description: \"Get the document name, current page, and list of all pages.\",\n schema: {},\n tier: \"read\",\n },\n {\n name: \"get_current_page\",\n description: \"Get the current page info and its top-level children.\",\n schema: {},\n tier: \"read\",\n },\n {\n name: \"set_current_page\",\n description: \"Switch to a different page. Provide either pageId or pageName.\",\n schema: {\n pageId: z.string().optional().describe(\"The page ID to switch to\"),\n pageName: z.string().optional().describe(\"The page name (case-insensitive, partial match)\"),\n },\n tier: \"read\",\n },\n {\n name: \"create_page\",\n description: \"Create a new page in the document\",\n schema: { name: z.string().optional().describe(\"Name for the new page (default: 'New Page')\") },\n tier: \"create\",\n },\n {\n name: \"rename_page\",\n description: \"Rename a page. Defaults to current page if no pageId given.\",\n schema: {\n newName: z.string().describe(\"New name for the page\"),\n pageId: z.string().optional().describe(\"Page ID (default: current page)\"),\n },\n tier: \"edit\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport type { ToolDef } from \"../types\";\n\nexport const tools: ToolDef[] = [\n {\n name: \"get_selection\",\n description: \"Get the current selection. Without depth, returns stubs (id/name/type). With depth, returns full serialized node trees.\",\n schema: { depth: z.coerce.number().optional().describe(\"Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited.\") },\n tier: \"read\",\n },\n {\n name: \"set_selection\",\n description: \"Set selection to nodes and scroll viewport to show them. Also works as focus (single node).\",\n schema: {\n nodeIds: flexJson(z.array(z.string())).describe('Array of node IDs to select. Example: [\"1:2\",\"1:3\"]'),\n },\n tier: \"read\",\n },\n];\n","import { z } from \"zod\";\n\n// AI agents (Claude, GPT, etc.) frequently pass numbers as strings\n// (\"10\" instead of 10), booleans as strings (\"true\" instead of true),\n// and objects/arrays as JSON strings. These helpers add resilient\n// coercion so tools don't fail on valid-but-mistyped input.\n\n/** Coerce \"true\"/\"false\"/\"1\"/\"0\" strings to boolean */\nexport const flexBool = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (v === \"true\" || v === \"1\") return true;\n if (v === \"false\" || v === \"0\") return false;\n return v;\n }, inner);\n\n/** Coerce JSON strings to parsed values (for objects/arrays that agents may stringify) */\nexport const flexJson = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (typeof v === \"string\") {\n try {\n return JSON.parse(v);\n } catch {\n return v;\n }\n }\n return v;\n }, inner);\n\n/** Coerce numeric strings only when they're valid numbers (safe for use inside unions) */\nexport const flexNum = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (typeof v === \"string\") {\n const n = Number(v);\n if (!isNaN(n) && v.trim() !== \"\") return n;\n }\n return v;\n }, inner);\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport type { ToolDef } from \"../types\";\n\nexport const tools: ToolDef[] = [\n {\n name: \"get_node_info\",\n description: \"Get detailed information about one or more nodes. Always pass an array of IDs. Use `fields` to select only the properties you need (reduces context size).\",\n schema: {\n nodeIds: flexJson(z.array(z.string())).describe('Array of node IDs. Example: [\"1:2\",\"1:3\"]'),\n depth: z.coerce.number().optional().describe(\"Child recursion depth (default: unlimited). 0=stubs only.\"),\n fields: flexJson(z.array(z.string())).optional().describe('Whitelist of property names to include. Example: [\"absoluteBoundingBox\",\"layoutMode\",\"fills\"]. Omit to return all properties.'),\n },\n tier: \"read\",\n },\n {\n name: \"search_nodes\",\n description: \"Search nodes on the current page by name and/or type. Use set_current_page first to search other pages. Paginated (default 50).\",\n schema: {\n query: z.string().optional().describe(\"Name search (case-insensitive substring). Omit to match all names.\"),\n types: flexJson(z.array(z.string())).optional().describe('Filter by types. Example: [\"FRAME\",\"TEXT\"]. Omit to match all types.'),\n scopeNodeId: z.string().optional().describe(\"Node ID to search within (defaults to current page)\"),\n caseSensitive: flexBool(z.boolean()).optional().describe(\"Case-sensitive name match (default false)\"),\n limit: z.coerce.number().optional().describe(\"Max results (default 50)\"),\n offset: z.coerce.number().optional().describe(\"Skip N results for pagination (default 0)\"),\n },\n tier: \"read\",\n },\n {\n name: \"export_node_as_image\",\n description: \"Export a node as an image from Figma\",\n schema: {\n nodeId: z.string().describe(\"The node ID to export\"),\n format: z.enum([\"PNG\", \"JPG\", \"SVG\", \"PDF\"]).optional().describe(\"Export format (default: PNG)\"),\n scale: z.coerce.number().positive().optional().describe(\"Export scale (default: 1)\"),\n },\n tier: \"read\",\n formatResponse: (result: unknown) => {\n const r = result as any;\n return {\n content: [{ type: \"image\" as const, data: r.imageData, mimeType: r.mimeType || \"image/png\" }],\n };\n },\n },\n];\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst sectionItem = z.object({\n name: z.string().optional().describe(\"Name (default: 'Section')\"),\n x: S.xPos,\n y: S.yPos,\n width: z.coerce.number().optional().describe(\"Width (default: 500)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 500)\"),\n parentId: S.parentId,\n fillColor: flexJson(S.colorRgba).optional().describe(\"Fill color. Default: no fill (transparent).\"),\n fillStyleName: z.string().optional().describe(\"Apply a fill paint style by name (case-insensitive).\"),\n fillVariableId: z.string().optional().describe(\"Bind a color variable to the fill.\"),\n});\n\nconst svgItem = z.object({\n svg: z.string().describe(\"SVG markup string\"),\n name: z.string().optional().describe(\"Layer name (default: 'SVG')\"),\n x: S.xPos,\n y: S.yPos,\n parentId: S.parentId,\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"create_section\",\n description: \"Create section nodes to organize content on the canvas. Default: no fill (transparent).\",\n schema: { items: flexJson(z.array(sectionItem)).describe(\"Array of sections to create\"), depth: S.depth },\n tier: \"create\",\n },\n {\n name: \"create_node_from_svg\",\n description: \"Create nodes from SVG strings.\",\n schema: { items: flexJson(z.array(svgItem)).describe(\"Array of SVG items to create\"), depth: S.depth },\n tier: \"create\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../utils/coercion\";\n\n// ─── Shared Zod Schema Fragments ────────────────────────────────\n// Import as: import * as S from \"./schemas\";\n\n/** Single node ID */\nexport const nodeId = z.string().describe(\"Node ID\");\n\n/** Array of node IDs */\nexport const nodeIds = flexJson(z.array(z.string())).describe(\"Array of node IDs\");\n\n/** Optional parent reference for creation tools */\nexport const parentId = z.string().optional()\n .describe(\"Parent node ID. Omit to place on current page.\");\n\n/**\n * Response depth — controls how much node detail is returned after an operation.\n * Omit for minimal response (id + name only).\n * 0 = node with full properties, children as stubs.\n * N = recurse N levels of children with full properties.\n * -1 = unlimited recursion.\n */\nexport const depth = z.coerce.number().optional()\n .describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\");\n\n/** X position for creation tools */\nexport const xPos = z.coerce.number().optional().describe(\"X position (default: 0)\");\n\n/** Y position for creation tools */\nexport const yPos = z.coerce.number().optional().describe(\"Y position (default: 0)\");\n\n/** Parse hex color string (#RGB, #RRGGBB, #RRGGBBAA) to {r,g,b,a} 0-1 */\nfunction parseHex(hex: string): { r: number; g: number; b: number; a?: number } | null {\n const m = hex.match(/^#?([0-9a-f]{3,8})$/i);\n if (!m) return null;\n let h = m[1];\n if (h.length === 3) h = h[0]+h[0]+h[1]+h[1]+h[2]+h[2];\n if (h.length === 4) h = h[0]+h[0]+h[1]+h[1]+h[2]+h[2]+h[3]+h[3];\n if (h.length !== 6 && h.length !== 8) return null;\n const r = parseInt(h.slice(0, 2), 16) / 255;\n const g = parseInt(h.slice(2, 4), 16) / 255;\n const b = parseInt(h.slice(4, 6), 16) / 255;\n if (h.length === 8) return { r, g, b, a: parseInt(h.slice(6, 8), 16) / 255 };\n return { r, g, b };\n}\n\n/** RGBA color — accepts {r,g,b,a?} object (0-1) or hex string (#RGB, #RRGGBB, #RRGGBBAA) */\nexport const colorRgba = z.preprocess((v) => {\n if (typeof v === \"string\") return parseHex(v) ?? v;\n return v;\n}, z.object({\n r: z.coerce.number().min(0).max(1),\n g: z.coerce.number().min(0).max(1),\n b: z.coerce.number().min(0).max(1),\n a: z.coerce.number().min(0).max(1).optional(),\n})).describe('Hex \"#FF0000\" or {r,g,b,a?} with values 0-1.');\n\n/** Single effect entry — shared by set_effects and styles create */\nexport const effectEntry = z.object({\n type: z.enum([\"DROP_SHADOW\", \"INNER_SHADOW\", \"LAYER_BLUR\", \"BACKGROUND_BLUR\"]),\n color: flexJson(colorRgba).optional(),\n offset: flexJson(z.object({ x: z.coerce.number(), y: z.coerce.number() })).optional(),\n radius: z.coerce.number(),\n spread: z.coerce.number().optional(),\n visible: flexBool(z.boolean()).optional(),\n blendMode: z.string().optional(),\n});\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst frameItem = z.object({\n name: z.string().optional().describe(\"Frame name (default: 'Frame')\"),\n x: S.xPos,\n y: S.yPos,\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n parentId: S.parentId,\n fillColor: flexJson(S.colorRgba).optional().describe('Fill color. Default: no fill.'),\n strokeColor: flexJson(S.colorRgba).optional().describe('Stroke color. Default: none.'),\n strokeWeight: z.coerce.number().positive().optional().describe(\"Stroke weight (default: 1)\"),\n cornerRadius: z.coerce.number().min(0).optional().describe(\"Corner radius (default: 0)\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Auto-layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional().describe(\"Wrap (default: NO_WRAP)\"),\n paddingTop: z.coerce.number().optional().describe(\"Top padding (default: 0)\"),\n paddingRight: z.coerce.number().optional().describe(\"Right padding (default: 0)\"),\n paddingBottom: z.coerce.number().optional().describe(\"Bottom padding (default: 0)\"),\n paddingLeft: z.coerce.number().optional().describe(\"Left padding (default: 0)\"),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: z.coerce.number().optional().describe(\"Spacing between children (default: 0)\"),\n fillStyleName: z.string().optional().describe(\"Apply a fill paint style by name (case-insensitive). Omit to skip.\"),\n strokeStyleName: z.string().optional().describe(\"Apply a stroke paint style by name. Omit to skip.\"),\n fillVariableId: z.string().optional().describe(\"Bind a color variable to the fill. Creates a solid fill and binds the variable to fills/0/color.\"),\n strokeVariableId: z.string().optional().describe(\"Bind a color variable to the stroke. Creates a solid stroke and binds the variable to strokes/0/color.\"),\n});\n\nconst autoLayoutItem = z.object({\n nodeIds: flexJson(z.array(z.string())).describe(\"Array of node IDs to wrap\"),\n name: z.string().optional().describe(\"Frame name (default: 'Auto Layout')\"),\n layoutMode: z.enum([\"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Direction (default: VERTICAL)\"),\n itemSpacing: z.coerce.number().optional().describe(\"Spacing between children (default: 0)\"),\n paddingTop: z.coerce.number().optional().describe(\"Top padding (default: 0)\"),\n paddingRight: z.coerce.number().optional().describe(\"Right padding (default: 0)\"),\n paddingBottom: z.coerce.number().optional().describe(\"Bottom padding (default: 0)\"),\n paddingLeft: z.coerce.number().optional().describe(\"Left padding (default: 0)\"),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"create_frame\",\n description: \"Create frames in Figma. Batch supported. Use fillStyleName/fillVariableId and strokeStyleName/strokeVariableId instead of hardcoded colors — hardcoded values skip design tokens and will trigger lint warnings.\",\n schema: { items: flexJson(z.array(frameItem)).describe(\"Array of frames to create\"), depth: S.depth },\n tier: \"create\",\n },\n {\n name: \"create_auto_layout\",\n description: \"Wrap existing nodes in an auto-layout frame. One call replaces create_frame + update_frame + insert_child × N.\",\n schema: { items: flexJson(z.array(autoLayoutItem)).describe(\"Array of auto-layout wraps to perform\"), depth: S.depth },\n tier: \"create\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst textItem = z.object({\n text: z.string().describe(\"Text content\"),\n name: z.string().optional().describe(\"Layer name (default: text content)\"),\n x: S.xPos,\n y: S.yPos,\n fontFamily: z.string().optional().describe(\"Font family (default: Inter). Use get_available_fonts to list installed fonts.\"),\n fontStyle: z.string().optional().describe(\"Font style, e.g. 'Regular', 'Bold', 'Italic' (default: derived from fontWeight). Overrides fontWeight when set.\"),\n fontSize: z.coerce.number().optional().describe(\"Font size (default: 14)\"),\n fontWeight: z.coerce.number().optional().describe(\"Font weight: 100-900 (default: 400). Ignored when fontStyle is set.\"),\n fontColor: flexJson(S.colorRgba).optional().describe('Font color. Default: black.'),\n fontColorVariableId: z.string().optional().describe(\"Bind a color variable to the text fill instead of hardcoded fontColor.\"),\n fontColorStyleName: z.string().optional().describe(\"Apply a paint style to the text fill by name (case-insensitive). Overrides fontColor.\"),\n parentId: S.parentId,\n textStyleId: z.string().optional().describe(\"Text style ID to apply (overrides fontSize/fontWeight). Omit to skip.\"),\n textStyleName: z.string().optional().describe(\"Text style name (case-insensitive match). Omit to skip.\"),\n textAlignHorizontal: z.enum([\"LEFT\", \"CENTER\", \"RIGHT\", \"JUSTIFIED\"]).optional().describe(\"Horizontal text alignment (default: LEFT)\"),\n textAlignVertical: z.enum([\"TOP\", \"CENTER\", \"BOTTOM\"]).optional().describe(\"Vertical text alignment (default: TOP)\"),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional().describe(\"Horizontal sizing. FILL auto-sets textAutoResize to HEIGHT.\"),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional().describe(\"Vertical sizing (default: HUG)\"),\n textAutoResize: z.enum([\"NONE\", \"WIDTH_AND_HEIGHT\", \"HEIGHT\", \"TRUNCATE\"]).optional().describe(\"Text auto-resize behavior (default: WIDTH_AND_HEIGHT when FILL)\"),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"create_text\",\n description: \"Create text nodes. Prefer textStyleName for typography and fontColorStyleName or fontColorVariableId for color — hardcoded values skip design tokens. Supports custom fonts via fontFamily.\",\n schema: { items: flexJson(z.array(textItem)).describe(\"Array of text nodes to create\"), depth: S.depth },\n tier: \"create\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst deleteItem = z.object({\n nodeId: z.string().describe(\"Node ID to delete\"),\n});\nconst cloneItem = z.object({\n nodeId: z.string().describe(\"Node ID to clone\"),\n parentId: z.string().optional().describe(\"Parent for the clone (e.g. a page ID). Defaults to same parent as original.\"),\n x: z.coerce.number().optional().describe(\"New X for clone. Omit to keep original position.\"),\n y: z.coerce.number().optional().describe(\"New Y for clone. Omit to keep original position.\"),\n});\nconst insertItem = z.object({\n parentId: z.string().describe(\"Parent node ID\"),\n childId: z.string().describe(\"Child node ID to move\"),\n index: z.coerce.number().optional().describe(\"Index to insert at (0=first). Omit to append.\"),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"delete_node\",\n description: \"Delete nodes. Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(deleteItem)).describe(\"Array of {nodeId}\") },\n tier: \"edit\",\n },\n {\n name: \"clone_node\",\n description: \"Clone nodes. Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(cloneItem)).describe(\"Array of {nodeId, x?, y?}\"), depth: S.depth },\n tier: \"create\",\n },\n {\n name: \"insert_child\",\n description: \"Move nodes into a parent at a specific index (reorder/reparent). Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(insertItem)).describe(\"Array of {parentId, childId, index?}\"), depth: S.depth },\n tier: \"edit\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst exportSettingEntry = z.object({\n format: z.enum([\"PNG\", \"JPG\", \"SVG\", \"PDF\"]),\n suffix: z.string().optional(),\n contentsOnly: flexBool(z.boolean()).optional(),\n constraint: flexJson(z.object({\n type: z.enum([\"SCALE\", \"WIDTH\", \"HEIGHT\"]),\n value: z.coerce.number(),\n })).optional(),\n});\n\nconst patchNodeItem = z.object({\n nodeId: S.nodeId,\n\n // Geometry (flat)\n x: z.coerce.number().optional().describe(\"X position\"),\n y: z.coerce.number().optional().describe(\"Y position\"),\n width: z.coerce.number().positive().optional().describe(\"Width (must provide height too)\"),\n height: z.coerce.number().positive().optional().describe(\"Height (must provide width too)\"),\n\n // Appearance (nested)\n fill: flexJson(z.object({\n color: flexJson(S.colorRgba).optional(),\n styleName: z.string().optional().describe(\"Paint style name (preferred over color)\"),\n clear: flexBool(z.boolean()).optional().describe(\"Set true to remove all fills\"),\n })).optional().describe(\"Fill color, style, or clear\"),\n\n stroke: flexJson(z.object({\n color: flexJson(S.colorRgba).optional(),\n weight: z.coerce.number().positive().optional().describe(\"Stroke weight\"),\n styleName: z.string().optional().describe(\"Paint style name (preferred over color)\"),\n })).optional().describe(\"Stroke color/weight or style\"),\n\n cornerRadius: flexJson(z.object({\n radius: z.coerce.number().min(0).describe(\"Corner radius\"),\n corners: flexJson(z.array(flexBool(z.boolean())).length(4)).optional()\n .describe(\"Which corners [topLeft, topRight, bottomRight, bottomLeft]. Default: all.\"),\n })).optional().describe(\"Corner radius\"),\n\n opacity: z.coerce.number().min(0).max(1).optional().describe(\"Opacity (0-1)\"),\n\n effects: flexJson(z.object({\n effects: flexJson(z.array(S.effectEntry)).optional().describe(\"Effect objects\"),\n styleName: z.string().optional().describe(\"Effect style name (preferred over raw effects)\"),\n })).optional().describe(\"Effects or effect style\"),\n\n constraints: flexJson(z.object({\n horizontal: z.enum([\"MIN\", \"CENTER\", \"MAX\", \"STRETCH\", \"SCALE\"]),\n vertical: z.enum([\"MIN\", \"CENTER\", \"MAX\", \"STRETCH\", \"SCALE\"]),\n })).optional().describe(\"Layout constraints\"),\n\n exportSettings: flexJson(z.array(exportSettingEntry)).optional().describe(\"Export settings\"),\n\n // Layout (nested)\n layout: flexJson(z.object({\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional(),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n paddingTop: z.coerce.number().optional(),\n paddingRight: z.coerce.number().optional(),\n paddingBottom: z.coerce.number().optional(),\n paddingLeft: z.coerce.number().optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: z.coerce.number().optional(),\n counterAxisSpacing: z.coerce.number().optional(),\n })).optional().describe(\"Auto-layout properties\"),\n\n // Text (nested)\n text: flexJson(z.object({\n fontSize: z.coerce.number().optional(),\n fontWeight: z.coerce.number().optional(),\n fontColor: flexJson(S.colorRgba).optional(),\n textStyleId: z.string().optional(),\n textStyleName: z.string().optional(),\n textAlignHorizontal: z.enum([\"LEFT\", \"CENTER\", \"RIGHT\", \"JUSTIFIED\"]).optional(),\n textAlignVertical: z.enum([\"TOP\", \"CENTER\", \"BOTTOM\"]).optional(),\n textAutoResize: z.enum([\"NONE\", \"WIDTH_AND_HEIGHT\", \"HEIGHT\", \"TRUNCATE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n })).optional().describe(\"Text properties (font, alignment, sizing)\"),\n\n // Escape hatch\n properties: flexJson(z.record(z.string(), z.unknown())).optional()\n .describe(\"Arbitrary key-value properties to set directly on the node\"),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"patch_nodes\",\n description: \"Patch properties on nodes. Combines geometry (x/y/width/height), appearance (fill, stroke, cornerRadius, opacity, effects, constraints, exportSettings), layout (auto-layout), text (font props), and arbitrary properties in one call. Prefer styleName over hardcoded colors. Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(patchNodeItem)).describe(\"Array of nodes to patch\"), depth: S.depth },\n tier: \"edit\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst textContentItem = z.object({\n nodeId: z.string().describe(\"Text node ID\"),\n text: z.string().describe(\"New text content\"),\n});\n\nconst scanTextItem = z.object({\n nodeId: S.nodeId,\n limit: z.coerce.number().optional().describe(\"Max text nodes to return (default: 50)\"),\n includePath: flexBool(z.boolean()).optional().describe(\"Include ancestor path strings (default: true). Set false to reduce payload.\"),\n includeGeometry: flexBool(z.boolean()).optional().describe(\"Include absoluteX/absoluteY/width/height (default: true). Set false to reduce payload.\"),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"set_text_content\",\n description: \"Set text content on text nodes. Batch: pass multiple items to replace text in multiple nodes at once.\",\n schema: { items: flexJson(z.array(textContentItem)).describe(\"Array of {nodeId, text}\"), depth: S.depth },\n tier: \"edit\",\n },\n {\n name: \"scan_text_nodes\",\n description: \"Scan all text nodes within a node tree. Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(scanTextItem)).describe(\"Array of {nodeId}\") },\n tier: \"read\",\n },\n];\n","import { z } from \"zod\";\nimport type { ToolDef } from \"../types\";\n\nexport const tools: ToolDef[] = [\n {\n name: \"get_available_fonts\",\n description: \"Get available fonts in Figma. Optionally filter by query string.\",\n schema: { query: z.string().optional().describe(\"Filter fonts by name (case-insensitive). Omit to list all fonts.\") },\n tier: \"read\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\n\nconst lintRules = z.enum([\n \"no-autolayout\",\n \"shape-instead-of-frame\",\n \"hardcoded-color\",\n \"no-text-style\",\n \"fixed-in-autolayout\",\n \"default-name\",\n \"empty-container\",\n \"stale-text-name\",\n \"no-text-property\",\n \"wcag-contrast\",\n \"wcag-contrast-enhanced\",\n \"wcag-non-text-contrast\",\n \"wcag-target-size\",\n \"wcag-text-size\",\n \"wcag-line-height\",\n \"wcag\",\n \"all\",\n]);\n\nexport const tools: ToolDef[] = [\n {\n name: \"lint_node\",\n description: \"Run design linter on a node tree. Returns issues grouped by category with affected node IDs and fix instructions. Lint child nodes individually for large trees.\",\n schema: {\n nodeId: z.string().optional().describe(\"Node ID to lint. Omit to lint current selection.\"),\n rules: flexJson(z.array(lintRules)).optional().describe('Rules to run. Default: [\"all\"]. Options: no-autolayout, shape-instead-of-frame, hardcoded-color, no-text-style, fixed-in-autolayout, default-name, empty-container, stale-text-name, no-text-property, all, wcag-contrast, wcag-contrast-enhanced, wcag-non-text-contrast, wcag-target-size, wcag-text-size, wcag-line-height, wcag'),\n maxDepth: z.coerce.number().optional().describe(\"Max depth to recurse (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Stop after N findings (default: 50)\"),\n },\n tier: \"read\",\n },\n {\n name: \"lint_fix_autolayout\",\n description: \"Auto-fix: convert frames with multiple children to auto-layout. Takes node IDs from lint_node 'no-autolayout' results.\",\n schema: {\n items: flexJson(z.array(z.object({\n nodeId: S.nodeId,\n layoutMode: z.enum([\"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: auto-detect based on child positions)\"),\n itemSpacing: z.coerce.number().optional().describe(\"Spacing between children (default: 0)\"),\n }))).describe(\"Array of frames to convert to auto-layout\"),\n depth: S.depth,\n },\n tier: \"edit\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexNum } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\nimport { endpointSchema } from \"../endpoint\";\n\nconst paintStyleItem = z.object({\n name: z.string().describe(\"Style name\"),\n color: flexJson(S.colorRgba).describe('Color.'),\n});\n\nconst textStyleItem = z.object({\n name: z.string().describe(\"Style name\"),\n fontFamily: z.string().describe(\"Font family\"),\n fontStyle: z.string().optional().describe(\"Font style (default: Regular)\"),\n fontSize: z.coerce.number().describe(\"Font size\"),\n lineHeight: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\", \"AUTO\"]) }),\n ])).optional().describe(\"Line height — number (px) or {value, unit}. Default: auto.\"),\n letterSpacing: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\"]) }),\n ])).optional().describe(\"Letter spacing — number (px) or {value, unit}. Default: 0.\"),\n textCase: z.enum([\"ORIGINAL\", \"UPPER\", \"LOWER\", \"TITLE\"]).optional(),\n textDecoration: z.enum([\"NONE\", \"UNDERLINE\", \"STRIKETHROUGH\"]).optional(),\n});\n\nconst effectStyleItem = z.object({\n name: z.string().describe(\"Style name\"),\n effects: flexJson(z.array(S.effectEntry)).describe(\"Array of effects\"),\n});\n\nconst patchBase = {\n id: z.string().describe(\"Style ID or name (case-insensitive match)\"),\n name: z.string().optional().describe(\"Rename the style\"),\n};\n\nconst patchPaintItem = z.object({\n ...patchBase,\n color: flexJson(S.colorRgba).optional().describe('New color.'),\n});\n\nconst patchTextItem = z.object({\n ...patchBase,\n fontFamily: z.string().optional().describe(\"Font family\"),\n fontStyle: z.string().optional().describe(\"Font style, e.g. Regular, Bold\"),\n fontSize: z.coerce.number().optional().describe(\"Font size\"),\n lineHeight: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\", \"AUTO\"]) }),\n ])).optional().describe(\"Line height — number (px) or {value, unit}\"),\n letterSpacing: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\"]) }),\n ])).optional().describe(\"Letter spacing — number (px) or {value, unit}\"),\n textCase: z.enum([\"ORIGINAL\", \"UPPER\", \"LOWER\", \"TITLE\"]).optional(),\n textDecoration: z.enum([\"NONE\", \"UNDERLINE\", \"STRIKETHROUGH\"]).optional(),\n});\n\nconst patchEffectItem = z.object({\n ...patchBase,\n effects: flexJson(z.array(S.effectEntry)).optional().describe(\"Array of effects\"),\n});\n\nconst patchAnyItem = z.object({\n ...patchBase,\n color: flexJson(S.colorRgba).optional(),\n fontFamily: z.string().optional(),\n fontStyle: z.string().optional(),\n fontSize: z.coerce.number().optional(),\n lineHeight: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\", \"AUTO\"]) }),\n ])).optional(),\n letterSpacing: flexNum(z.union([\n z.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\"]) }),\n ])).optional(),\n textCase: z.enum([\"ORIGINAL\", \"UPPER\", \"LOWER\", \"TITLE\"]).optional(),\n textDecoration: z.enum([\"NONE\", \"UNDERLINE\", \"STRIKETHROUGH\"]).optional(),\n effects: flexJson(z.array(S.effectEntry)).optional(),\n});\n\nconst createSchemas: Record<string, z.ZodTypeAny> = {\n paint: paintStyleItem, text: textStyleItem, effect: effectStyleItem,\n};\nconst updateSchemas: Record<string, z.ZodTypeAny> = {\n paint: patchPaintItem, text: patchTextItem, effect: patchEffectItem,\n};\n\nexport const tools: ToolDef[] = [\n {\n name: \"styles\",\n description:\n \"CRUD endpoint for local styles (paint, text, effect).\\n\" +\n \" list → {type?, fields?, offset?, limit?} → {totalCount, items: [{id, name, type, ...}]}\\n\" +\n \" get → {id, fields?} → style object (full detail; fields to filter)\\n\" +\n \" create → {type, items: [...]} → {results: [{id}, ...]}\\n\" +\n \" update → {type?, items: [{id, ...}]} → {results: ['ok'|{warning}, ...]}\\n\" +\n \" delete → {id} or {items: [{id}, ...]} → 'ok' or {results: ['ok', ...]}\",\n schema: (caps) => endpointSchema(\n [\"create\", \"get\", \"list\", \"update\", \"delete\"],\n caps,\n {\n type: z.enum([\"paint\", \"text\", \"effect\"]).optional()\n .describe(\"Style type. Required for create. Filters list by type. Optional for update (strict per-type validation; omit to auto-detect).\"),\n items: flexJson(z.array(z.any())).optional()\n .describe(\"Create: [{name, color}] (paint), [{name, fontFamily, fontSize, ...}] (text), [{name, effects}] (effect). Update: [{id, ...fields}]. Delete (batch): [{id}, ...].\"),\n depth: S.depth,\n },\n ),\n tier: \"read\",\n validate: (params: any) => {\n if (params.items) {\n const map = params.method === \"update\" ? updateSchemas : createSchemas;\n const itemSchema = (params.type && map[params.type]) || patchAnyItem;\n params.items = z.array(itemSchema).parse(params.items);\n }\n },\n },\n];\n","/**\n * Shared endpoint infrastructure.\n *\n * Every resource endpoint follows the same contract:\n * create → items[{...}] → { results: [{id}, ...] }\n * get → { id, fields? } → resource object (field-filtered)\n * list → { filters?, fields?, offset, limit } → { totalCount, returned, offset, limit, items: [...] }\n * update → items[{...}] → { results: [\"ok\", ...] }\n * delete → { id } or items[{id}] → \"ok\" or { results: [\"ok\", ...] }\n *\n * MCP side: endpointSchema()\n * Figma side: createDispatcher() + paginate()\n */\n\nimport { z } from \"zod\";\nimport { flexJson } from \"../utils/coercion\";\nimport type { Capabilities } from \"./types\";\n\n// ─── Method Types ────────────────────────────────────────────────\n\nexport type EndpointMethod = \"create\" | \"get\" | \"list\" | \"update\" | \"delete\";\n\n// ─── Response Types ──────────────────────────────────────────────\n\n/** Batch response envelope (create, update, delete). Produced by batchHandler. */\nexport interface BatchResponse<T = { id: string }> {\n results: Array<T | \"ok\" | { error: string }>;\n warnings?: string[];\n deferred?: string;\n}\n\n/** Paginated list response envelope. */\nexport interface ListResponse<T = Record<string, any>> {\n totalCount: number;\n returned: number;\n offset: number;\n limit: number;\n items: T[];\n}\n\n// ─── Discriminated Param Types ───────────────────────────────────\n//\n// Each endpoint specializes these with its own create/update item\n// types and list filters. Example:\n//\n// type StyleParams = EndpointParams<StyleCreateItem, StyleUpdateItem, { type?: string }>;\n//\n\nexport type EndpointParams<\n TCreate = Record<string, any>,\n TUpdate = Record<string, any>,\n TListFilters = Record<string, never>,\n> =\n | { method: \"create\"; items: TCreate[] }\n | { method: \"get\"; id: string; fields?: string[] }\n | ({ method: \"list\"; fields?: string[]; offset?: number; limit?: number } & TListFilters)\n | { method: \"update\"; items: TUpdate[] }\n | { method: \"delete\"; id?: string; items?: Array<{ id: string }> };\n\n// ─── Helpers ────────────────────────────────────────────────────\n\n/**\n * Top-level field filter for get/list responses.\n * Always preserves identity fields (id, name, type).\n * Pass [\"*\"] to return all fields.\n */\nexport function pickFields(obj: Record<string, any>, fields: string[]): Record<string, any> {\n if (fields.includes(\"*\")) return obj;\n const keep = new Set([...fields, \"id\", \"name\", \"type\"]);\n const out: Record<string, any> = {};\n for (const key of Object.keys(obj)) {\n if (keep.has(key)) out[key] = obj[key];\n }\n return out;\n}\n\n/**\n * Paginate an array of items. Default limit: 100.\n * Call from list handlers after assembling the full result set.\n */\nexport function paginate<T>(items: T[], offset = 0, limit = 100): ListResponse<T> {\n const sliced = items.slice(offset, offset + limit);\n return { totalCount: items.length, returned: sliced.length, offset, limit, items: sliced };\n}\n\n// ─── Schema Builder ──────────────────────────────────────────────\n\n/** Maps each endpoint method to the minimum tier required to use it. */\nexport type MethodTier = \"read\" | \"create\" | \"edit\";\n\nconst DEFAULT_TIERS: Record<string, MethodTier> = {\n get: \"read\", list: \"read\", create: \"create\", update: \"edit\", delete: \"edit\",\n};\n\n/**\n * Build standard endpoint Zod schema fields.\n *\n * Always includes `method`. Auto-adds:\n * - `id` when get/delete are in the method list\n * - `fields` when get or list are in the method list\n * - `offset`/`limit` when list is in the method list\n * Merge endpoint-specific fields (items, list filters) via `extra`.\n *\n * When `caps` is provided, methods are filtered by tier — only methods\n * whose tier is enabled appear in the enum.\n */\nexport function endpointSchema(\n methods: string[],\n capsOrExtra?: Capabilities | Record<string, z.ZodTypeAny>,\n extraOrTiers?: Record<string, z.ZodTypeAny>,\n methodTiers?: Record<string, MethodTier>,\n): Record<string, z.ZodTypeAny> {\n // Overload resolution: (methods, extra?) or (methods, caps, extra?, tiers?)\n let caps: Capabilities | undefined;\n let extra: Record<string, z.ZodTypeAny> | undefined;\n\n if (capsOrExtra && (\"create\" in capsOrExtra) && (\"edit\" in capsOrExtra)\n && typeof (capsOrExtra as any).create === \"boolean\") {\n caps = capsOrExtra as Capabilities;\n extra = extraOrTiers;\n } else {\n extra = capsOrExtra as Record<string, z.ZodTypeAny> | undefined;\n // methodTiers and extraOrTiers are unused in the legacy call signature\n }\n\n // Filter methods by capabilities\n let filtered = methods;\n if (caps) {\n const tiers = { ...DEFAULT_TIERS, ...methodTiers };\n filtered = methods.filter(m => {\n const tier = tiers[m] ?? \"edit\"; // unknown methods default to edit\n if (tier === \"read\") return true;\n if (tier === \"create\") return caps!.create;\n if (tier === \"edit\") return caps!.edit;\n return false;\n });\n }\n\n const schema: Record<string, z.ZodTypeAny> = {\n method: z.enum(filtered as [string, ...string[]]),\n };\n if (filtered.includes(\"get\") || filtered.includes(\"delete\")) {\n schema.id = z.string().optional().describe(\"Resource ID (get, delete)\");\n }\n if (filtered.includes(\"get\") || filtered.includes(\"list\")) {\n schema.fields = flexJson(z.array(z.string())).optional()\n .describe('Property whitelist (get/list). Identity fields (id, name, type) always included. Omit for stubs on list, full detail on get. Pass [\"*\"] for all fields.');\n }\n if (filtered.includes(\"list\")) {\n schema.offset = z.coerce.number().optional().describe(\"Skip N items for pagination (default 0)\");\n schema.limit = z.coerce.number().optional().describe(\"Max items per page (default 100)\");\n }\n return { ...schema, ...extra };\n}\n\n// ─── Figma Dispatcher ────────────────────────────────────────────\n\ntype MethodHandlers = Record<string, (params: any) => Promise<any>>;\n\n/**\n * Create a Figma handler that dispatches on `params.method`.\n * Only methods with registered handlers are allowed.\n * Automatically applies `fields` filtering on get responses.\n */\nexport function createDispatcher(handlers: MethodHandlers) {\n const supported = Object.keys(handlers).join(\", \");\n return async (params: any): Promise<any> => {\n const method = params.method as EndpointMethod;\n const handler = handlers[method];\n if (!handler) throw new Error(`Method '${method}' not supported. Available: ${supported}`);\n let result = await handler(params);\n // Auto-apply fields filtering on get responses (full detail by default)\n if (method === \"get\" && params.fields?.length && result && typeof result === \"object\") {\n result = pickFields(result, params.fields);\n }\n return result;\n };\n}\n","import { z } from \"zod\";\nimport { flexJson } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\nimport { endpointSchema } from \"../endpoint\";\nimport type { MethodTier } from \"../endpoint\";\n\nconst collectionCreateItem = z.object({\n name: z.string().describe(\"Collection name\"),\n});\n\nconst addModeItem = z.object({\n collectionId: z.string().describe(\"Collection ID\"),\n name: z.string().describe(\"Mode name\"),\n});\n\nconst renameModeItem = z.object({\n collectionId: z.string().describe(\"Collection ID\"),\n modeId: z.string().describe(\"Mode ID\"),\n name: z.string().describe(\"New name\"),\n});\n\nconst removeModeItem = z.object({\n collectionId: z.string().describe(\"Collection ID\"),\n modeId: z.string().describe(\"Mode ID\"),\n});\n\nconst deleteCollectionItem = z.object({\n id: z.string().describe(\"Collection ID\"),\n});\n\nconst collectionMethodSchemas: Record<string, z.ZodTypeAny> = {\n create: collectionCreateItem,\n delete: deleteCollectionItem,\n add_mode: addModeItem,\n rename_mode: renameModeItem,\n remove_mode: removeModeItem,\n};\n\nconst variableCreateItem = z.object({\n collectionId: z.string().describe(\"Variable collection ID\"),\n name: z.string().describe(\"Variable name\"),\n resolvedType: z.enum([\"COLOR\", \"FLOAT\", \"STRING\", \"BOOLEAN\"]).describe(\"Variable type\"),\n});\n\nconst variableUpdateItem = z.object({\n id: z.string().describe(\"Variable ID (full ID, e.g. VariableID:1:6)\"),\n modeId: z.string().describe(\"Mode ID\"),\n value: flexJson(z.union([\n z.number(), z.boolean(), S.colorRgba,\n ])).describe('Value: number, boolean, or color (hex \"#RRGGBB\" or {r,g,b,a?} 0-1)'),\n});\n\nconst variableMethodSchemas: Record<string, z.ZodTypeAny> = {\n create: variableCreateItem,\n update: variableUpdateItem,\n};\n\nconst bindingItem = z.object({\n nodeId: z.string().describe(\"Node ID\"),\n field: z.string().describe(\"Property field (e.g., 'opacity', 'fills/0/color')\"),\n variableId: z.string().describe(\"Variable ID (use full ID from create_variable response, e.g. VariableID:1:6)\"),\n});\n\nconst setExplicitModeItem = z.object({\n nodeId: S.nodeId,\n collectionId: z.string().describe(\"Variable collection ID\"),\n modeId: z.string().describe(\"Mode ID to pin (e.g. Dark mode)\"),\n});\n\nconst vcMethodTiers: Record<string, MethodTier> = {\n add_mode: \"create\",\n rename_mode: \"edit\",\n remove_mode: \"edit\",\n};\n\nexport const tools: ToolDef[] = [\n {\n name: \"variable_collections\",\n description:\n `CRUD endpoint for variable collections + mode management.\n create → {items: [{name}]} → {results: [{id, modes, defaultModeId}]}\n get → {id, fields?} → collection object\n list → {fields?, offset?, limit?} → paginated stubs\n delete → {id} or {items: [{id}]} → 'ok' or {results: ['ok', ...]}\n add_mode → {items: [{collectionId, name}]} → {results: [{modeId, modes}]}\n rename_mode → {items: [{collectionId, modeId, name}]} → {results: [{modes}]}\n remove_mode → {items: [{collectionId, modeId}]} → {results: [{modes}]}`,\n schema: (caps) => endpointSchema(\n [\"create\", \"get\", \"list\", \"delete\", \"add_mode\", \"rename_mode\", \"remove_mode\"],\n caps,\n {\n items: flexJson(z.array(z.any())).optional()\n .describe(\"create: [{name}]. delete (batch): [{id}]. add_mode: [{collectionId, name}]. rename_mode: [{collectionId, modeId, name}]. remove_mode: [{collectionId, modeId}].\"),\n },\n vcMethodTiers,\n ),\n tier: \"read\",\n validate: (params: any) => {\n if (params.items) {\n const schema = collectionMethodSchemas[params.method];\n if (schema) params.items = z.array(schema).parse(params.items);\n }\n },\n },\n {\n name: \"variables\",\n description:\n `CRUD endpoint for design variables.\n create → {items: [{collectionId, name, resolvedType}]} → {results: [{id}]}\n get → {id, fields?} → variable object (full detail)\n list → {type?, collectionId?, fields?, offset?, limit?} → paginated stubs (fields for detail)\n update → {items: [{id, modeId, value}]} → {results: ['ok', ...]}`,\n schema: (caps) => endpointSchema(\n [\"create\", \"get\", \"list\", \"update\"],\n caps,\n {\n items: flexJson(z.array(z.any())).optional()\n .describe(\"create: [{collectionId, name, resolvedType}]. update: [{id, modeId, value}].\"),\n type: z.enum([\"COLOR\", \"FLOAT\", \"STRING\", \"BOOLEAN\"]).optional()\n .describe(\"Filter list by variable type.\"),\n collectionId: z.string().optional()\n .describe(\"Filter list by collection ID.\"),\n },\n ),\n tier: \"read\",\n validate: (params: any) => {\n if (params.items) {\n const schema = variableMethodSchemas[params.method];\n if (schema) params.items = z.array(schema).parse(params.items);\n }\n },\n },\n {\n name: \"set_variable_binding\",\n description: \"Bind variables to node properties. Common fields: 'fills/0/color', 'strokes/0/color', 'opacity', 'topLeftRadius', 'itemSpacing'. Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(bindingItem)).describe(\"Array of {nodeId, field, variableId}\") },\n tier: \"edit\",\n },\n {\n name: \"set_explicit_variable_mode\",\n description: \"Pin a variable collection mode on a frame (e.g. show Dark mode). Batch: pass multiple items.\",\n schema: { items: flexJson(z.array(setExplicitModeItem)).describe(\"Array of {nodeId, collectionId, modeId}\") },\n tier: \"edit\",\n },\n {\n name: \"get_node_variables\",\n description: \"Get variable bindings on a node. Returns which variables are bound to fills, strokes, opacity, corner radius, etc.\",\n schema: { nodeId: S.nodeId },\n tier: \"read\",\n },\n];\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef } from \"../types\";\nimport { endpointSchema } from \"../endpoint\";\n\nconst componentItem = z.object({\n name: z.string().describe(\"Component name\"),\n x: S.xPos,\n y: S.yPos,\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n parentId: S.parentId,\n fillColor: flexJson(S.colorRgba).optional().describe('Fill color. Omit for no fill.'),\n fillStyleName: z.string().optional().describe(\"Apply a fill paint style by name (case-insensitive).\"),\n fillVariableId: z.string().optional().describe(\"Bind a color variable to the fill.\"),\n strokeColor: flexJson(S.colorRgba).optional().describe('Stroke color. Omit for no stroke.'),\n strokeStyleName: z.string().optional().describe(\"Apply a stroke paint style by name.\"),\n strokeVariableId: z.string().optional().describe(\"Bind a color variable to the stroke.\"),\n strokeWeight: z.coerce.number().positive().optional().describe(\"Stroke weight (default: 1)\"),\n cornerRadius: z.coerce.number().optional().describe(\"Corner radius (default: 0)\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional().describe(\"Wrap behavior (default: NO_WRAP)\"),\n paddingTop: z.coerce.number().optional().describe(\"Top padding (default: 0)\"),\n paddingRight: z.coerce.number().optional().describe(\"Right padding (default: 0)\"),\n paddingBottom: z.coerce.number().optional().describe(\"Bottom padding (default: 0)\"),\n paddingLeft: z.coerce.number().optional().describe(\"Left padding (default: 0)\"),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional().describe(\"Primary axis alignment (default: MIN)\"),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional().describe(\"Counter axis alignment (default: MIN)\"),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional().describe(\"Horizontal sizing (default: FIXED)\"),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional().describe(\"Vertical sizing (default: FIXED)\"),\n itemSpacing: z.coerce.number().optional().describe(\"Spacing between children (default: 0)\"),\n});\n\nconst fromNodeItem = z.object({\n nodeId: S.nodeId,\n exposeText: flexBool(z.boolean()).default(true).describe(\"Auto-expose text children as editable TEXT properties and bind them (default: true). Set false to skip.\"),\n});\n\nconst combineItem = z.object({\n componentIds: flexJson(z.array(z.string())).describe(\"Component IDs to combine (min 2)\"),\n name: z.string().optional().describe(\"Name for the component set. Omit to auto-generate.\"),\n});\n\nconst updateComponentItem = z.object({\n id: z.string().describe(\"Component node ID\"),\n propertyName: z.string().describe(\"Property name\"),\n type: z.enum([\"BOOLEAN\", \"TEXT\", \"INSTANCE_SWAP\", \"VARIANT\"]).describe(\"Property type\"),\n defaultValue: flexBool(z.union([z.string(), z.boolean()])).describe(\"Default value (string for TEXT/VARIANT, boolean for BOOLEAN)\"),\n preferredValues: flexJson(z.array(z.object({\n type: z.enum([\"COMPONENT\", \"COMPONENT_SET\"]),\n key: z.string(),\n })).optional()).describe(\"Preferred values for INSTANCE_SWAP type. Omit for none.\"),\n});\n\nconst componentCreateSchemas: Record<string, z.ZodTypeAny> = {\n component: componentItem,\n from_node: fromNodeItem,\n variant_set: combineItem,\n};\n\nconst instanceCreateItem = z.object({\n componentId: z.string().describe(\"Component or component set ID\"),\n variantProperties: flexJson(z.record(z.string(), z.string())).optional().describe('Pick variant by properties, e.g. {\"Style\":\"Secondary\",\"Size\":\"Large\"}. Ignored for plain COMPONENT IDs.'),\n x: z.coerce.number().optional().describe(\"X position. Omit to keep default.\"),\n y: z.coerce.number().optional().describe(\"Y position. Omit to keep default.\"),\n parentId: S.parentId,\n});\n\nconst instanceUpdateItem = z.object({\n id: S.nodeId,\n properties: flexJson(z.record(z.string(), z.union([z.string(), z.boolean()]))).describe('Property key→value map, e.g. {\"Label#1:0\":\"Click Me\"}'),\n});\n\nexport const tools: ToolDef[] = [\n {\n name: \"components\",\n description:\n `CRUD endpoint for components.\n create → {type, items, depth?} → {results: [{id}, ...]}\n type 'component': create from scratch with layout/style params\n type 'from_node': convert existing nodes to components. Text children are auto-exposed as editable properties by default (exposeText: true) — instances can set text directly via properties.\n type 'variant_set': combine components into variant sets\n get → {id, fields?} → component object (full detail, field-filterable)\n list → {name?, setsOnly?, fields?, offset?, limit?} → paginated stubs\n update → {items: [{id, propertyName, type, defaultValue}]} → creates property AND binds matching text node automatically`,\n schema: (caps) => endpointSchema(\n [\"create\", \"get\", \"list\", \"update\"],\n caps,\n {\n items: flexJson(z.array(z.any())).optional()\n .describe(\"create (component): [{name, parentId?, ...layout}]. create (from_node): [{nodeId, exposeText?}]. create (variant_set): [{componentIds, name?}]. update: [{id, propertyName, type, defaultValue}].\"),\n type: z.enum([\"component\", \"from_node\", \"variant_set\"]).optional()\n .describe(\"Create type. Required for create: 'component' (from scratch), 'from_node' (convert existing), 'variant_set' (combine as variants).\"),\n depth: S.depth,\n name: z.string().optional().describe(\"Filter list by name (case-insensitive substring).\"),\n setsOnly: flexBool(z.boolean()).optional().describe(\"If true, list returns only COMPONENT_SET nodes.\"),\n },\n ),\n tier: \"read\",\n validate: (params: any) => {\n if (params.items) {\n if (params.method === \"create\") {\n const schema = params.type && componentCreateSchemas[params.type];\n if (!schema) throw new Error(`create requires type: component, from_node, or variant_set`);\n params.items = z.array(schema).parse(params.items);\n } else if (params.method === \"update\") {\n params.items = z.array(updateComponentItem).parse(params.items);\n }\n }\n },\n },\n {\n name: \"instances\",\n description:\n `CRUD endpoint for component instances.\n create → {items: [{componentId, variantProperties?, x?, y?, parentId?}], depth?} → {results: [{id}]}\n get → {id} → {mainComponentId, overrides: [{id, fields}]}\n update → {items: [{id, properties}]} → {results: ['ok', ...]}`,\n schema: (caps) => endpointSchema(\n [\"create\", \"get\", \"update\"],\n caps,\n {\n items: flexJson(z.array(z.any())).optional()\n .describe(\"create: [{componentId, variantProperties?, x?, y?, parentId?}]. update: [{id, properties}].\"),\n depth: S.depth,\n },\n ),\n tier: \"read\",\n validate: (params: any) => {\n if (params.items) {\n if (params.method === \"create\") {\n params.items = z.array(instanceCreateItem).parse(params.items);\n } else if (params.method === \"update\") {\n params.items = z.array(instanceUpdateItem).parse(params.items);\n }\n }\n },\n },\n];\n","import type { McpServer } from \"./types\";\n\nexport function registerPrompts(server: McpServer) {\n server.registerPrompt(\n \"design_strategy\",\n { description: \"Best practices for working with Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: `When working with Figma designs, follow these best practices:\n\n1. Understand Before Creating:\n - Use get_document_info() to see pages and current page\n - Use styles(method: \"list\") and get_local_variables() to discover existing design tokens\n - Plan layout hierarchy before creating elements\n\n2. Use Design Tokens — Never Hardcode:\n - Colors: use fillStyleName/strokeStyleName (paint styles) or fillVariableId/strokeVariableId (variables)\n - Text: use textStyleName to apply text styles that control font size, weight, and line height together\n - Effects: use effectStyleName to apply shadow/blur styles\n - Only use raw fillColor/fontColor for one-off values not in the design system\n\n3. Auto-Layout First:\n - Use create_frame() with layoutMode: \"VERTICAL\" or \"HORIZONTAL\" for every container\n - Set itemSpacing, padding, and alignment at creation time\n - Use layoutSizingHorizontal/Vertical: \"FILL\" for responsive children\n - Avoid absolute positioning — let auto-layout handle spacing\n\n4. Naming Conventions:\n - Use descriptive, semantic names for all elements\n - Name components with Property=Value pattern (e.g. \"Size=Small\") before components(method: \"create\", type: \"variant_set\")\n\n5. Variable Modes:\n - Use set_explicit_variable_mode() to pin a frame to a specific mode (e.g. Dark)\n - Use get_node_variables() to verify which variables are bound to a node\n\n6. Quality Check — Run Lint:\n - After building a section, run lint_node() to catch common issues:\n * hardcoded-color: fills/strokes not using styles or variables\n * no-text-style: text without a text style applied\n * no-autolayout: frames with children but no auto-layout\n * default-name: nodes still named \"Frame\", \"Rectangle\", etc.\n - Use lint_fix_autolayout() to auto-fix layout issues\n - Lint early and often — it is cheaper to fix issues during creation than after`,\n },\n }],\n description: \"Best practices for working with Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"read_design_strategy\",\n { description: \"Best practices for reading Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: `When reading Figma designs, follow these best practices:\n\n1. Start with selection:\n - First use get_selection() to understand the current selection\n - If no selection ask user to select single or multiple nodes\n`,\n },\n }],\n description: \"Best practices for reading Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"text_replacement_strategy\",\n { description: \"Systematic approach for replacing text in Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: `# Intelligent Text Replacement Strategy\n\n## 1. Analyze Design & Identify Structure\n- Scan text nodes to understand the overall structure of the design\n- Use AI pattern recognition to identify logical groupings:\n * Tables (rows, columns, headers, cells)\n * Lists (items, headers, nested lists)\n * Card groups (similar cards with recurring text fields)\n * Forms (labels, input fields, validation text)\n * Navigation (menu items, breadcrumbs)\n\\`\\`\\`\nscan_text_nodes(nodeId: \"node-id\")\nget_node_info(nodeId: \"node-id\") // optional\n\\`\\`\\`\n\n## 2. Strategic Chunking for Complex Designs\n- Divide replacement tasks into logical content chunks based on design structure\n- Use one of these chunking strategies that best fits the design:\n * **Structural Chunking**: Table rows/columns, list sections, card groups\n * **Spatial Chunking**: Top-to-bottom, left-to-right in screen areas\n * **Semantic Chunking**: Content related to the same topic or functionality\n * **Component-Based Chunking**: Process similar component instances together\n\n## 3. Progressive Replacement with Verification\n- Create a safe copy of the node for text replacement\n- Replace text chunk by chunk with continuous progress updates\n- After each chunk is processed:\n * Export that section as a small, manageable image\n * Verify text fits properly and maintain design integrity\n * Fix issues before proceeding to the next chunk\n\n\\`\\`\\`\n// Clone the node to create a safe copy\nclone_node(nodeId: \"selected-node-id\", x: [new-x], y: [new-y])\n\n// Replace text chunk by chunk\nset_text_content(\n items: [\n { nodeId: \"node-id-1\", text: \"New text 1\" },\n // More nodes in this chunk...\n ]\n)\n\n// Verify chunk with small, targeted image exports\nexport_node_as_image(nodeId: \"chunk-node-id\", format: \"PNG\", scale: 0.5)\n\\`\\`\\`\n\n## 4. Intelligent Handling for Table Data\n- For tabular content:\n * Process one row or column at a time\n * Maintain alignment and spacing between cells\n * Consider conditional formatting based on cell content\n * Preserve header/data relationships\n\n## 5. Smart Text Adaptation\n- Adaptively handle text based on container constraints:\n * Auto-detect space constraints and adjust text length\n * Apply line breaks at appropriate linguistic points\n * Maintain text hierarchy and emphasis\n * Consider font scaling for critical content that must fit\n\n## 6. Progressive Feedback Loop\n- Establish a continuous feedback loop during replacement:\n * Real-time progress updates (0-100%)\n * Small image exports after each chunk for verification\n * Issues identified early and resolved incrementally\n * Quick adjustments applied to subsequent chunks\n\n## 7. Final Verification & Context-Aware QA\n- After all chunks are processed:\n * Export the entire design at reduced scale for final verification\n * Check for cross-chunk consistency issues\n * Verify proper text flow between different sections\n * Ensure design harmony across the full composition\n\n## 8. Chunk-Specific Export Scale Guidelines\n- Scale exports appropriately based on chunk size:\n * Small chunks (1-5 elements): scale 1.0\n * Medium chunks (6-20 elements): scale 0.7\n * Large chunks (21-50 elements): scale 0.5\n * Very large chunks (50+ elements): scale 0.3\n * Full design verification: scale 0.2\n\n## Sample Chunking Strategy for Common Design Types\n\n### Tables\n- Process by logical rows (5-10 rows per chunk)\n- Alternative: Process by column for columnar analysis\n- Tip: Always include header row in first chunk for reference\n\n### Card Lists\n- Group 3-5 similar cards per chunk\n- Process entire cards to maintain internal consistency\n- Verify text-to-image ratio within cards after each chunk\n\n### Forms\n- Group related fields (e.g., \"Personal Information\", \"Payment Details\")\n- Process labels and input fields together\n- Ensure validation messages and hints are updated with their fields\n\n### Navigation & Menus\n- Process hierarchical levels together (main menu, submenu)\n- Respect information architecture relationships\n- Verify menu fit and alignment after replacement\n\n## Best Practices\n- **Preserve Design Intent**: Always prioritize design integrity\n- **Structural Consistency**: Maintain alignment, spacing, and hierarchy\n- **Visual Feedback**: Verify each chunk visually before proceeding\n- **Incremental Improvement**: Learn from each chunk to improve subsequent ones\n- **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight\n- **Respect Content Relationships**: Keep related content consistent across chunks\n\nRemember that text is never just text—it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.`,\n },\n }],\n description: \"Systematic approach for replacing text in Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"swap_overrides_instances\",\n { description: \"Guide to swap instance overrides between instances\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: `# Swap Component Instance Overrides\n\n## Overview\nTransfer content overrides from a source instance to target instances.\n\n## Process\n\n### 1. Identify Instances\n- Use \\`get_selection()\\` to identify selected instances\n- Use \\`search_nodes(types: [\"INSTANCE\"])\\` to find instances on the page\n\n### 2. Extract Source Overrides\n- \\`instances(method: \"get\", id: \"source-instance-id\")\\`\n- Returns mainComponentId and per-child override fields (characters, fills, fontSize, etc.)\n\n### 3. Apply to Targets\n- For text overrides: use \\`set_text_content\\` on matching child node IDs\n- For style overrides: use \\`patch_nodes\\` with fill/stroke/text/effects styleName fields\n- Match children by name path — source and target instances share the same internal structure\n\n### 4. Verify\n- \\`get_node_info(nodeId, depth: 1)\\` on target instances\n- \\`export_node_as_image\\` for visual verification`,\n },\n }],\n description: \"Strategy for transferring overrides between component instances in Figma\",\n })\n );\n\n server.registerPrompt(\n \"missing_tools\",\n { description: \"Why create or edit tools are missing and how to fix it\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: `# Missing Create / Edit Tools\n\nIf the user asks you to create or modify something in Figma but you cannot find tools like \\`create_frame\\`, \\`create_text\\`, \\`patch_nodes\\`, \\`delete_node\\`, or \\`set_text_content\\`, the MCP server was started without the correct access tier flag.\n\nVibma filters tools at startup based on CLI flags passed in the MCP config \\`args\\` array:\n\n| Flag | Tools available |\n|------|----------------|\n| _(none)_ | Read-only (inspect, search, export) |\n| \\`--create\\` | Read + creation tools |\n| \\`--edit\\` | All tools (read + create + edit + delete) |\n\nAsk the user to add \\`--edit\\` (or \\`--create\\`) to their MCP config args:\n\n\\`\\`\\`json\n{\n \"mcpServers\": {\n \"Vibma\": {\n \"command\": \"npx\",\n \"args\": [\"-y\", \"@ufira/vibma\", \"--edit\"]\n }\n }\n}\n\\`\\`\\`\n\nAfter updating, the user must restart their AI tool or reload MCP servers — stdio-based servers cannot hot-reload.`,\n },\n }],\n description: \"Why create or edit tools are missing and how to fix it\",\n })\n );\n}\n","import type { McpServer, SendCommandFn, Capabilities } from \"./types\";\nimport { registerTools } from \"./registry\";\n\n// Import tool definitions from all modules\nimport { tools as connectionTools } from \"./defs/connection\";\nimport { tools as documentTools } from \"./defs/document\";\nimport { tools as selectionTools } from \"./defs/selection\";\nimport { tools as nodeInfoTools } from \"./defs/node-info\";\nimport { tools as createShapeTools } from \"./defs/create-shape\";\nimport { tools as createFrameTools } from \"./defs/create-frame\";\nimport { tools as createTextTools } from \"./defs/create-text\";\nimport { tools as modifyNodeTools } from \"./defs/modify-node\";\nimport { tools as patchNodesTools } from \"./defs/patch-nodes\";\nimport { tools as textTools } from \"./defs/text\";\nimport { tools as fontTools } from \"./defs/fonts\";\nimport { tools as lintTools } from \"./defs/lint\";\nimport { tools as styleTools } from \"./defs/styles\";\nimport { tools as variableTools } from \"./defs/variables\";\nimport { tools as componentTools } from \"./defs/components\";\nimport { registerPrompts } from \"./prompts\";\n\nexport const allTools = [\n ...connectionTools,\n ...documentTools,\n ...selectionTools,\n ...nodeInfoTools,\n ...createShapeTools,\n ...createFrameTools,\n ...createTextTools,\n ...modifyNodeTools,\n ...patchNodesTools,\n ...textTools,\n ...fontTools,\n ...lintTools,\n ...styleTools,\n ...variableTools,\n ...componentTools,\n];\n\n/** Register all MCP tools and prompts on the server */\nexport function registerAllTools(server: McpServer, sendCommand: SendCommandFn, caps: Capabilities) {\n registerTools(server, sendCommand, caps, allTools);\n registerPrompts(server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M,CAAC,UAAU;AACtB,SAAO,MAAM,mCAAmC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AACxG,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["import_zod","server","caps","tools","tools","import_zod","import_zod","tools","import_zod","tools","import_zod","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","tools","import_zod","import_zod","caps","tools","caps","import_zod","tools","caps","import_zod","tools","caps","server","tools","server","caps","WebSocket","uuidv4"]}
|
|
1
|
+
{"version":3,"sources":["../src/mcp.ts","../src/tools/mcp-registry.ts","../src/tools/registry.ts","../src/tools/types.ts","../src/tools/generated/help.ts","../src/tools/generated/defs.ts","../src/utils/coercion.ts","../src/tools/schemas.ts","../src/tools/generated/guidelines.ts","../src/tools/prompts.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { z } from \"zod\";\nimport WebSocket from \"ws\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { readFileSync } from \"fs\";\nimport { join, basename } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { registerAllTools } from \"./tools/mcp-registry\";\nimport { resolveEndpointHelp } from \"./tools/generated/help\";\n\n// Read version — works with both tsx (source) and node (compiled dist/)\nlet VIBMA_VERSION = \"0.0.0\";\ntry {\n // Walk up from current file's dir to find package.json\n // Use import.meta.url (works in ESM), __dirname (works in CJS), process.cwd() as last resort\n const start = typeof import.meta?.url !== \"undefined\"\n ? join(fileURLToPath(import.meta.url), \"..\")\n : typeof __dirname !== \"undefined\" ? __dirname : process.cwd();\n for (let dir = start; dir !== \"/\"; dir = join(dir, \"..\")) {\n try {\n const pkg = JSON.parse(readFileSync(join(dir, \"package.json\"), \"utf8\"));\n if (pkg.name === \"@ufira/vibma\") { VIBMA_VERSION = pkg.version; break; }\n // Workspace root — dist/ is at root level, read core package version\n if (pkg.workspaces) {\n try { VIBMA_VERSION = JSON.parse(readFileSync(join(dir, \"packages/core/package.json\"), \"utf8\")).version; } catch {}\n break;\n }\n } catch { continue; }\n }\n} catch { /* fallback */ }\n\n// ─── Logger (stderr so it doesn't pollute MCP stdio) ────────────\nconst logger = {\n info: (msg: string) => process.stderr.write(`[INFO] ${msg}\\n`),\n debug: (msg: string) => process.stderr.write(`[DEBUG] ${msg}\\n`),\n warn: (msg: string) => process.stderr.write(`[WARN] ${msg}\\n`),\n error: (msg: string) => process.stderr.write(`[ERROR] ${msg}\\n`),\n log: (msg: string) => process.stderr.write(`[LOG] ${msg}\\n`),\n};\n\n// ─── Types ───────────────────────────────────────────────────────\n\ninterface FigmaResponse {\n id: string;\n result?: any;\n error?: string;\n}\n\ninterface CommandProgressUpdate {\n type: \"command_progress\";\n commandId: string;\n commandType: string;\n status: \"started\" | \"in_progress\" | \"completed\" | \"error\";\n progress: number;\n totalItems: number;\n processedItems: number;\n currentChunk?: number;\n totalChunks?: number;\n chunkSize?: number;\n message: string;\n payload?: any;\n timestamp: number;\n}\n\n// ─── WebSocket state ─────────────────────────────────────────────\n\nlet ws: WebSocket | null = null;\nconst pendingRequests = new Map<\n string,\n {\n resolve: (value: unknown) => void;\n reject: (reason: unknown) => void;\n timeout: ReturnType<typeof setTimeout>;\n lastActivity: number;\n }\n>();\nlet currentChannel: string | null = null;\nlet activePort: number = parseInt(process.env.VIBMA_PORT || \"3055\");\nlet rejected = false; // Suppress auto-reconnect after ROLE_OCCUPIED rejection\nlet versionWarning: string | null = null;\n\n// CLI args\nconst args = process.argv.slice(2);\nconst serverArg = args.find((a) => a.startsWith(\"--server=\"));\nconst portArg = args.find((a) => a.startsWith(\"--port=\"));\nconst serverUrl = serverArg ? serverArg.split(\"=\")[1] : (process.env.VIBMA_SERVER || \"localhost\");\nif (portArg) activePort = parseInt(portArg.split(\"=\")[1]);\nconst isLocal = /^(localhost|127\\.0\\.0\\.1|host\\.docker\\.internal|0\\.0\\.0\\.0)(:|$)/.test(serverUrl)\n || serverUrl.endsWith(\".local\");\nconst WS_URL = isLocal ? `ws://${serverUrl}` : `wss://${serverUrl}`;\n\n// Access-tier flags: read is always on, --create / --edit opt-in\nconst caps = {\n create: args.includes(\"--create\") || args.includes(\"--edit\"),\n edit: args.includes(\"--edit\"),\n};\n\n// ─── WebSocket connection ────────────────────────────────────────\n\nfunction connectToFigma(port: number = activePort) {\n activePort = port;\n if (ws && ws.readyState === WebSocket.OPEN) {\n logger.info(\"Already connected to Figma\");\n return;\n }\n\n const wsUrl = isLocal ? `${WS_URL}:${port}` : WS_URL;\n logger.info(`Connecting to Figma socket server at ${wsUrl}...`);\n ws = new WebSocket(wsUrl);\n\n ws.on(\"open\", () => {\n logger.info(\"Connected to Figma socket server\");\n currentChannel = null;\n });\n\n ws.on(\"message\", (data: any) => {\n try {\n const json = JSON.parse(data) as any;\n\n // Handle same-client rejoin (already in channel)\n if (json.type === \"join-success\") {\n logger.info(json.message);\n if (json.id && pendingRequests.has(json.id)) {\n const req = pendingRequests.get(json.id)!;\n clearTimeout(req.timeout);\n req.resolve({ status: \"already_joined\", channel: json.channel });\n pendingRequests.delete(json.id);\n }\n return;\n }\n\n // Handle system messages with a code (version mismatch, peer join/leave)\n // Note: join-success also uses type=system but carries message.id + message.result — let those fall through\n if (json.type === \"system\" && json.code) {\n if (json.code === \"VERSION_MISMATCH\") {\n versionWarning = json.message;\n logger.warn(`Version mismatch: ${json.message}`);\n }\n return;\n }\n\n // Handle relay errors (e.g., ROLE_OCCUPIED rejection)\n if (json.type === \"error\") {\n logger.error(`Relay error: ${json.message}`);\n if (json.code === \"ROLE_OCCUPIED\") rejected = true;\n if (json.id && pendingRequests.has(json.id)) {\n const req = pendingRequests.get(json.id)!;\n clearTimeout(req.timeout);\n req.reject(new Error(json.message));\n pendingRequests.delete(json.id);\n }\n return;\n }\n\n // Handle progress updates\n if (json.type === \"progress_update\") {\n const progressData = json.message.data as CommandProgressUpdate;\n const requestId = json.id || \"\";\n\n if (requestId && pendingRequests.has(requestId)) {\n const request = pendingRequests.get(requestId)!;\n request.lastActivity = Date.now();\n clearTimeout(request.timeout);\n request.timeout = setTimeout(() => {\n if (pendingRequests.has(requestId)) {\n logger.error(`Request ${requestId} timed out after extended period of inactivity`);\n pendingRequests.delete(requestId);\n request.reject(new Error(\"Request to Figma timed out\"));\n }\n }, 60000);\n logger.info(`Progress update for ${progressData.commandType}: ${progressData.progress}% - ${progressData.message}`);\n if (progressData.status === \"completed\" && progressData.progress === 100) {\n logger.info(`Operation ${progressData.commandType} completed, waiting for final result`);\n }\n }\n return;\n }\n\n // Handle regular responses\n const myResponse = json.message;\n logger.debug(`Received message: ${JSON.stringify(myResponse)}`);\n\n if (myResponse.id && pendingRequests.has(myResponse.id) && myResponse.result) {\n const request = pendingRequests.get(myResponse.id)!;\n clearTimeout(request.timeout);\n if (myResponse.error) {\n logger.error(`Error from Figma: ${myResponse.error}`);\n request.reject(new Error(myResponse.error));\n } else {\n request.resolve(myResponse.result);\n }\n pendingRequests.delete(myResponse.id);\n } else {\n logger.info(`Received broadcast message: ${JSON.stringify(myResponse)}`);\n }\n } catch (error) {\n logger.error(`Error parsing message: ${error instanceof Error ? error.message : String(error)}`);\n }\n });\n\n ws.on(\"error\", (error) => {\n logger.error(`Socket error: ${error}`);\n });\n\n ws.on(\"close\", () => {\n logger.info(\"Disconnected from Figma socket server\");\n ws = null;\n for (const [id, request] of pendingRequests.entries()) {\n clearTimeout(request.timeout);\n request.reject(new Error(\"Connection closed\"));\n pendingRequests.delete(id);\n }\n if (rejected) {\n logger.info('Not reconnecting — channel role was rejected. Call connection(method: \"create\") to retry.');\n } else {\n logger.info(\"Attempting to reconnect in 2 seconds...\");\n setTimeout(() => connectToFigma(port), 2000);\n }\n });\n}\n\n// ─── Channel management ──────────────────────────────────────────\n\nasync function joinChannel(channelName: string): Promise<void> {\n rejected = false; // Reset rejection state on explicit join attempt\n versionWarning = null;\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n connectToFigma();\n // Wait briefly for connection\n await new Promise((resolve) => setTimeout(resolve, 1000));\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"Not connected to relay. Check that the relay server is running.\");\n }\n }\n try {\n await sendCommandToFigma(\"join\", { channel: channelName });\n currentChannel = channelName;\n logger.info(`Joined channel: ${channelName}`);\n } catch (error) {\n logger.error(`Failed to join channel: ${error instanceof Error ? error.message : String(error)}`);\n throw error;\n }\n}\n\n// ─── Send command to Figma ───────────────────────────────────────\n\nfunction sendCommandToFigma(\n command: string,\n params: unknown = {},\n timeoutMs: number = 30000\n): Promise<unknown> {\n return new Promise((resolve, reject) => {\n if (!ws || ws.readyState !== WebSocket.OPEN) {\n connectToFigma();\n reject(new Error(\"Not connected to Figma. Attempting to connect...\"));\n return;\n }\n\n const requiresChannel = command !== \"join\";\n if (requiresChannel && !currentChannel) {\n reject(new Error('No channel joined. Call connection(method: \"create\") first with the channel name shown in the Figma plugin panel.'));\n return;\n }\n\n const id = uuidv4();\n const request = {\n id,\n type: command === \"join\" ? \"join\" : \"message\",\n ...(command === \"join\"\n ? { channel: (params as any).channel, role: \"mcp\", version: VIBMA_VERSION, name: basename(process.cwd()) }\n : { channel: currentChannel }),\n message: {\n id,\n command,\n params: {\n ...(params as any),\n commandId: id,\n },\n },\n };\n\n const timeout = setTimeout(() => {\n if (pendingRequests.has(id)) {\n pendingRequests.delete(id);\n logger.error(`Request ${id} to Figma timed out after ${timeoutMs / 1000} seconds`);\n reject(new Error(\n `Request to Figma timed out. This usually means the Figma plugin is not connected to the relay. ` +\n `MCP is using port ${activePort}, channel \"${currentChannel}\". ` +\n `Check the Figma plugin window: the port and channel name must match.`\n ));\n }\n }, timeoutMs);\n\n pendingRequests.set(id, { resolve, reject, timeout, lastActivity: Date.now() });\n logger.info(`Sending command to Figma: ${command}`);\n logger.debug(`Request details: ${JSON.stringify(request)}`);\n ws.send(JSON.stringify(request));\n });\n}\n\n// ─── MCP Server bootstrap ────────────────────────────────────────\n\nconst server = new McpServer({\n name: \"VibmaMCP\",\n version: \"1.0.0\",\n});\n\n// ─── Connection endpoint (inline methods + Figma ping) ──────────\n\nimport { tools as generatedTools } from \"./tools/generated/defs\";\nconst connectionDef = generatedTools.find(t => t.name === \"connection\")!;\nconst connectionSchema = typeof connectionDef.schema === \"function\" ? connectionDef.schema(caps) : connectionDef.schema;\n\nserver.registerTool(\n \"connection\",\n { description: connectionDef.description, inputSchema: connectionSchema },\n async (params: any) => {\n const method = params.method;\n try {\n if (method === \"help\") {\n const text = resolveEndpointHelp(\"connection\", params.topic) ?? \"No help available for connection\";\n return { content: [{ type: \"text\", text }] };\n }\n\n if (method === \"create\") {\n const channel = params.channel || \"vibma\";\n await joinChannel(channel);\n await new Promise((r) => setTimeout(r, 200));\n let msg = `Joined channel \"${channel}\" on port ${activePort}. Call connection(method: \"get\") to verify the Figma plugin is connected.`;\n if (versionWarning) msg += `\\n\\n⚠️ ${versionWarning}\\nSee \"Version mismatch\" in CARRYME.md or DRAGME.md for update steps.`;\n msg += \"\\n\\nWelcome to Vibma! As you work, the MCP will give you warnings when it spots issues — hardcoded colors, missing auto-layout, unbound tokens, etc. Following these best practices will reduce the noise from the MCP and help you create a well-structured design system that designers enjoy working with.\";\n return { content: [{ type: \"text\", text: msg }] };\n }\n\n if (method === \"list\") {\n const url = isLocal\n ? `http://${serverUrl}:${activePort}/channels`\n : `https://${serverUrl}/channels`;\n const response = await fetch(url);\n if (!response.ok) return { content: [{ type: \"text\", text: `Relay returned ${response.status}: ${await response.text()}` }] };\n const data = await response.json();\n return { content: [{ type: \"text\", text: JSON.stringify(data, null, 2) }] };\n }\n\n if (method === \"delete\") {\n const targetChannel = params.channel || currentChannel || \"vibma\";\n const url = isLocal\n ? `http://${serverUrl}:${activePort}/channels/${encodeURIComponent(targetChannel)}`\n : `https://${serverUrl}/channels/${encodeURIComponent(targetChannel)}`;\n const res = await fetch(url, { method: \"DELETE\" });\n const body = await res.json() as { ok: boolean; message: string };\n for (const [reqId, request] of pendingRequests.entries()) {\n clearTimeout(request.timeout);\n request.reject(new Error(\"Tunnel reset by user\"));\n pendingRequests.delete(reqId);\n }\n if (ws) { const old = ws; ws = null; old.removeAllListeners(); old.close(1000, \"Tunnel reset\"); }\n currentChannel = null;\n rejected = false;\n connectToFigma();\n await new Promise((resolve) => setTimeout(resolve, 1000));\n const connected = ws && ws.readyState === WebSocket.OPEN;\n return {\n content: [{\n type: \"text\",\n text: connected\n ? `Tunnel reset: ${body.message}. Reconnected on port ${activePort}.\\n\\nIMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin, then call connection(method: \"create\") followed by connection(method: \"get\").`\n : `Tunnel reset: ${body.message}. Reconnection in progress.\\n\\nIMPORTANT: The Figma plugin was also disconnected. Ask the user to reopen the Vibma plugin, then call connection(method: \"create\") to retry.`,\n }],\n };\n }\n\n // method === \"get\" — send ping to Figma\n const result = await sendCommandToFigma(\"connection.get\", params, 5000);\n return { content: [{ type: \"text\", text: JSON.stringify(result) }] };\n } catch (error) {\n return { content: [{ type: \"text\", text: `connection.${method} error: ${error instanceof Error ? error.message : String(error)}` }] };\n }\n }\n);\n\n// Register all per-tool-file tools and prompts\nregisterAllTools(server, sendCommandToFigma, caps);\n\n// ─── Start ───────────────────────────────────────────────────────\n\nfunction cleanup() {\n if (ws && ws.readyState === WebSocket.OPEN) {\n ws.close(1000, \"MCP server shutting down\");\n }\n}\n\nprocess.on(\"SIGINT\", () => { cleanup(); process.exit(0); });\nprocess.on(\"SIGTERM\", () => { cleanup(); process.exit(0); });\nprocess.on(\"exit\", cleanup);\nprocess.stdin.on(\"end\", () => { cleanup(); process.exit(0); });\n\nasync function main() {\n try {\n connectToFigma();\n } catch (error) {\n logger.warn(`Could not connect to Figma initially: ${error instanceof Error ? error.message : String(error)}`);\n logger.warn(\"Will try to connect when the first command is sent\");\n }\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n logger.info(\"FigmaMCP server running on stdio\");\n}\n\nmain().catch((error) => {\n logger.error(`Error starting FigmaMCP server: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n});\n","import { z } from \"zod\";\nimport type { McpServer, SendCommandFn, Capabilities } from \"./types\";\nimport { registerTools } from \"./registry\";\n\n// Generated endpoint tools (schema compiler output)\nimport { tools as generatedTools } from \"./generated/defs\";\nimport { resolveHelp } from \"./generated/help\";\nimport { resolveGuideline } from \"./generated/guidelines\";\n\nimport { registerPrompts } from \"./prompts\";\n\n// Connection endpoint is registered directly in mcp.ts (has inline methods)\nconst endpointTools = generatedTools.filter(t => t.name !== \"connection\");\n\n// Wire per-method response formatter for frames.export (returns binary image, not JSON)\nconst framesTool = endpointTools.find(t => t.name === \"frames\");\nif (framesTool) {\n framesTool.methodFormatters = {\n export: (result: unknown) => {\n const r = result as any;\n // SVG_STRING returns raw text, not binary\n if (r.isString) {\n return { content: [{ type: \"text\" as const, text: r.imageData }] };\n }\n return {\n content: [{ type: \"image\" as const, data: r.imageData, mimeType: r.mimeType || \"image/png\" }],\n };\n },\n };\n}\n\nexport const allTools = [...endpointTools];\n\n/** Register all MCP tools and prompts on the server */\nexport function registerAllTools(server: McpServer, sendCommand: SendCommandFn, caps: Capabilities) {\n // Standalone help tool — directory of all endpoints, handled locally\n server.registerTool(\"help\", {\n description: 'Get help on any endpoint or method. Lists all endpoints, their methods, and detailed parameter docs.\\nExamples: help() → directory, help(topic: \"components\") → endpoint details, help(topic: \"components.create\") → method params.',\n inputSchema: {\n topic: z.string().optional().describe('Endpoint or endpoint.method name, e.g. \"components\" or \"components.create\"'),\n },\n }, async (params: any) => {\n return { content: [{ type: \"text\" as const, text: resolveHelp(params.topic) }] };\n });\n\n // Standalone guidelines tool — design methodology, handled locally\n server.registerTool(\"guidelines\", {\n description: 'Design guidelines for building quality Figma designs. Covers layout, responsiveness, tokens, components, accessibility, naming, and workflow.\\nExamples: guidelines() → list topics, guidelines(topic: \"responsive-designs\") → full guideline.',\n inputSchema: {\n topic: z.string().optional().describe('Guideline topic name, e.g. \"responsive-designs\" or \"token-discipline\"'),\n },\n }, async (params: any) => {\n return { content: [{ type: \"text\" as const, text: resolveGuideline(params.topic) }] };\n });\n\n registerTools(server, sendCommand, caps, allTools);\n registerPrompts(server);\n}\n","import { ZodError } from \"zod\";\nimport type { McpServer, SendCommandFn, Capabilities, ToolDef } from \"./types\";\nimport { mcpJson, mcpError } from \"./types\";\nimport { resolveHelp, resolveEndpointHelp } from \"./generated/help\";\n\n/**\n * Resolve the Figma command name for a tool call.\n *\n * - If tool has a commandMap, uses params.method to look up the command.\n * Convention: command = \"{toolName}.{method}\"\n * - Otherwise falls back to tool.command or tool.name (legacy standalone tools).\n */\nfunction resolveCommand(tool: ToolDef, params: any): string {\n if (tool.commandMap && params.method) {\n const cmd = tool.commandMap[params.method];\n if (cmd) return cmd;\n }\n return tool.command ?? tool.name;\n}\n\n/**\n * Batch-register declarative ToolDefs on the MCP server.\n *\n * 1. Filters by tier: read → always, create → caps.create, edit → caps.edit\n * 2. Resolves dynamic schemas (endpoint tools pass caps-dependent functions)\n * 3. Generates a uniform handler: validate? → sendCommand → formatResponse ?? mcpJson\n */\nexport function registerTools(\n server: McpServer,\n sendCommand: SendCommandFn,\n caps: Capabilities,\n tools: ToolDef[],\n): void {\n for (const tool of tools) {\n // Tier gate\n if (tool.tier === \"create\" && !caps.create) continue;\n if (tool.tier === \"edit\" && !caps.edit) continue;\n\n const schema = typeof tool.schema === \"function\" ? tool.schema(caps) : tool.schema;\n const timeout = tool.timeout;\n const defaultFormat = tool.formatResponse ?? mcpJson;\n\n server.registerTool(tool.name, { description: tool.description, inputSchema: schema }, async (params: any) => {\n try {\n // Help method — handled inline, not sent to Figma\n if (params.method === \"help\") {\n const text = resolveEndpointHelp(tool.name, params.topic) ?? resolveHelp(tool.name);\n return { content: [{ type: \"text\" as const, text }] };\n }\n\n if (tool.validate) tool.validate(params);\n const command = resolveCommand(tool, params);\n const result = await sendCommand(command, params, timeout);\n const format = (tool.methodFormatters?.[params.method]) ?? defaultFormat;\n return format(result);\n } catch (e) {\n if (e instanceof ZodError) {\n const hints = e.issues.map(i => {\n const path = i.path.join(\".\");\n return `[${path}] ${i.message}`;\n });\n return mcpError(`${tool.name} validation error`, hints.join(\"; \"));\n }\n return mcpError(`${tool.name} error`, e);\n }\n });\n }\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport type { z } from \"zod\";\n\n/** Function signature for sending commands to Figma via WebSocket */\nexport type SendCommandFn = (command: string, params?: unknown, timeoutMs?: number) => Promise<unknown>;\n\n/** Re-export McpServer type for tool files */\nexport type { McpServer };\n\n// ─── Tool Registry Types ────────────────────────────────────────\n\n/** Access tier for a tool */\nexport type ToolTier = \"read\" | \"create\" | \"edit\";\n\n/** Which tiers are enabled for this MCP session */\nexport interface Capabilities { create: boolean; edit: boolean }\n\n/** Declarative tool definition — replaces imperative registerMcpTools() */\nexport interface ToolDef {\n name: string;\n description: string;\n schema: Record<string, z.ZodTypeAny>\n | ((caps: Capabilities) => Record<string, z.ZodTypeAny>);\n tier: ToolTier;\n /** Figma command name. Defaults to name. For legacy standalone tools. */\n command?: string;\n /** Method → Figma command dispatch map. For endpoint tools (generated by schema compiler). */\n commandMap?: Record<string, string>;\n /** sendCommand timeout in ms (default: 30 000) */\n timeout?: number;\n /** Pre-send validation (e.g. per-method item parsing for endpoints) */\n validate?: (params: any) => void;\n /** Custom response formatter. Default: mcpJson */\n formatResponse?: (result: unknown) => any;\n /** Per-method response formatters. Overrides formatResponse for specific methods. */\n methodFormatters?: Record<string, (result: unknown) => any>;\n}\n\n/** Standard batch result from Figma handlers */\nexport interface BatchResult<T = unknown> {\n results: Array<T | \"ok\" | { error: string }>;\n warnings?: string[];\n /** Set when some items were deferred (e.g. font loading cap exceeded) */\n deferred?: string;\n}\n\n/** Max response size in characters (~12K tokens). Prevents LLM client-side truncation that corrupts JSON. */\nconst MAX_RESPONSE_CHARS = 50_000;\n\n/** Format a successful MCP response (JSON). Returns a clean error if response exceeds safe size. */\nexport function mcpJson(data: unknown) {\n const text = JSON.stringify(data);\n if (text.length <= MAX_RESPONSE_CHARS) {\n return { content: [{ type: \"text\" as const, text }] };\n }\n return {\n content: [{\n type: \"text\" as const,\n text: JSON.stringify({\n _error: \"response_too_large\",\n _sizeKB: Math.round(text.length / 1024),\n warning: \"Response exceeds safe size. Use 'depth', 'fields', 'limit', or 'summaryOnly' parameters to reduce response size.\",\n }),\n }],\n };\n}\n\n/** Format an error MCP response */\nexport function mcpError(prefix: string, error: unknown) {\n const msg = error instanceof Error ? error.message : String(error);\n return { content: [{ type: \"text\" as const, text: `${prefix}: ${msg}` }] };\n}\n","// AUTO-GENERATED by schema compiler — do not edit\n\nexport const helpDirectory: string = \"# Available Endpoints\\n\\n[design-system]\\n components Create and manage reusable components and variant sets.\\n fonts Search available fonts in Figma.\\n instances Create and manage component instances.\\n styles CRUD for local paint, text, effect, and grid styles.\\n variable_collections CRUD for variable collections — the document-level API for design tokens.\\n variables Search and update design variables within a collection.\\n\\n[connection]\\n connection Manage the Figma plugin connection.\\n\\n[document]\\n document Navigate and manage Figma pages (canvases) in the document.\\n version_history Save named versions to the Figma file's version history.\\n\\n[creation]\\n frames Create and manage frames, shapes, auto-layout containers, sections, and SVG nodes.\\n text Create and manage text nodes.\\n\\n[quality]\\n lint Run design quality and accessibility checks.\\n\\n[interaction]\\n prototyping Manage prototype interactions, reactions, and navigation flows.\\n\\n[node-inspection]\\n selection Read and set the current Figma selection.\\n\\nTopics:\\n missing_tools Why create or edit tools are missing and how to fix it\\n\\nUse help(topic: \\\"<endpoint>\\\") for endpoint details.\\nUse help(topic: \\\"<endpoint>.<method>\\\") for method details.\";\n\nexport const helpEndpoints: Record<string, { summary: string; methods: Record<string, string> }> = {\n \"components\": {\n \"summary\": \"# components\\nCreate and manage reusable components and variant sets.\\n\\nMethods:\\n clone Duplicate nodes [create]\\n audit Run lint on a node — returns severity-ranked findings [read]\\n reparent Move nodes into a new parent [edit]\\n list List local component names (variant sets as single entries) [read]\\n get Get component detail — property definitions + ID for instances.create [read]\\n create Create components [create]\\n update Add, edit, or delete component properties [edit]\\n delete Delete components or component sets [edit]\\n\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\\n// ---\\n// visible: false hides the node. Omitted from response when true (the default).\\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\\n// rotation: degrees (0-360). Omitted when 0.\\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\\n// bindings: bind design variables to node properties. field uses slash path: \\\"fills/0/color\\\" (first fill), \\\"strokes/0/color\\\", \\\"opacity\\\", \\\"width\\\", \\\"height\\\", \\\"cornerRadius\\\", \\\"paddingLeft\\\", \\\"itemSpacing\\\".\\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\\n// properties: escape hatch — set any Figma node property directly. Use only when no dedicated field exists.\\ninterface Node {\\n id: string; name: string; type: string;\\n visible?: boolean; // omitted when true\\n locked?: boolean; // omitted when false\\n opacity?: number; // omitted when 1\\n rotation?: number; // omitted when 0\\n blendMode?: string; // omitted when PASS_THROUGH\\n layoutPositioning?: \\\"AUTO\\\" | \\\"ABSOLUTE\\\";\\n layoutSizingHorizontal?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n layoutSizingVertical?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\\n fills?: Paint[]; // solid: {type: \\\"SOLID\\\", color: {r, g, b, a}}\\n strokes?: Paint[];\\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\\n children?: NodeStub[]; // stubs: {id, name, type} — use depth to expand\\n}\\n// PatchItem uses flat params matching create shape — no nested sub-objects.\\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\\n// Unknown keys produce a warning, preventing silent failures.\\n// Components are reusable design elements. Instances stay linked to the component and inherit changes.\\n// Workflow: create component (with properties) → add children → create instances via instances.create.\\n// ---\\n// A component set (variant set) groups related components as variants (e.g. Button/Primary, Button/Secondary).\\n// Property types: BOOLEAN (toggle visibility), TEXT (editable text), INSTANCE_SWAP (swap child instance), VARIANT (variant picker).\\n// exposeText: when creating from_node, text children become editable TEXT properties on the component.\\n// Auto-bind: TEXT properties auto-bind to text children with matching names (case-insensitive).\\n// Example: properties:[{propertyName:\\\"Label\\\", type:\\\"TEXT\\\", defaultValue:\\\"Click\\\"}] binds to a child text node named \\\"Label\\\".\\n// text.create accepts componentPropertyName to bind on creation — walks up ancestors to find the nearest component.\\n// For nested text (text inside frames inside a component), componentPropertyName resolves via ancestor walk. Alternatively, pass componentId explicitly.\\n// For existing nodes with many text children, prefer components(method:\\\"create\\\", type:\\\"from_node\\\", exposeText:true) — it auto-discovers, creates TEXT properties, and binds all text nodes in one operation.\\n// Property keys: read returns clean names (\\\"Label\\\"), write requires the #suffix (\\\"Label#1:0\\\"). Call components.get(id) to discover exact keys before edit/delete.\\n// ComponentItem accepts the same params as FrameItem (layout, fill, stroke, sizing, min/max).\\n// A component IS a frame — create it directly with all layout properties, then add children.\\n// SIZING: Components with text need a width constraint — set width + layoutSizingHorizontal:\\\"FIXED\\\".\\n// Without it, text won't wrap and the component grows unboundedly.\\n// HUG on both axes is only correct for intrinsically-sized elements (buttons, badges, icons).\\n// action: \\\"add\\\" (default) — requires type + defaultValue. \\\"edit\\\" — pass defaultValue to change value, name to rename property. \\\"delete\\\" — just propertyName#suffix.\\n// action: \\\"rename_variant\\\" — renames a variant option VALUE (not the property). Pass defaultValue=current option name, name=new option name.\\n// For VARIANT properties: \\\"edit\\\" with defaultValue reorders children to set the default variant.\\n\\nUse components(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"clone\": \"# components.clone\\nDuplicate nodes\\n\\nParams:\\n id (string, required) — Node ID\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"audit\": \"# components.audit\\nRun lint on a node — returns severity-ranked findings\\n\\nParams:\\n id (string, required) — Node ID to audit\\n rules (string[], optional) — Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\\n maxDepth (number, optional) — Max tree depth (default: 10)\\n maxFindings (number, optional) — Max findings (default: 50)\",\n \"reparent\": \"# components.reparent\\nMove nodes into a new parent\\n\\nParams:\\n items (array, required) — Array of {id, parentId, index?}\\n id (string, required)\\n parentId (string, required)\\n index (number, optional)\",\n \"list\": \"# components.list\\nList local component names (variant sets as single entries)\\n\\nParams:\\n query (string, optional) — Name search query (case-insensitive substring match)\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"get\": \"# components.get\\nGet component detail — property definitions + ID for instances.create\\n\\nParams:\\n id (string, optional) — Component or component set ID\\n names (string[], optional) — Batch lookup by name (case-insensitive). Either id or names is required.\",\n \"create\": \"# components.create\\nCreate components\\n\\nExample: components(method:\\\"create\\\", type:\\\"component\\\", items:[{name:\\\"Card\\\", layoutMode:\\\"VERTICAL\\\", padding:\\\"16\\\", itemSpacing:\\\"8\\\", fillVariableName:\\\"bg/surface\\\", children:[{type:\\\"text\\\", text:\\\"Title\\\", componentPropertyName:\\\"Title\\\"}, {type:\\\"text\\\", text:\\\"Description\\\", fontSize:14, componentPropertyName:\\\"Description\\\"}], properties:[{propertyName:\\\"Show Icon\\\", type:\\\"BOOLEAN\\\", defaultValue:true}]}])\\n\\nDiscriminant: type (component | from_node | variant_set)\\n\\n ## component — Create component with full frame properties (layout, fill, stroke, sizing). A component IS a frame — build directly, no need to create a frame first.\\n name (string, required) — Component name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width (default: 100)\\n height (number, optional) — Height (default: 100)\\n rotation (number, optional) — Rotation in degrees (0-360)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n description (string, optional) — Component description (shown in Figma's component panel)\\n children (array, optional) — Inline child nodes. Text: {type:\\\"text\\\", text, componentPropertyName?, fontFamily?, fontSize?, fontColor?}. Frame: {type:\\\"frame\\\", name?, layoutMode?, fillColor?, children?}. Text with componentPropertyName auto-creates and binds a TEXT property — no need to add it to properties separately.\\n properties (array, optional) — Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.\\n propertyName (string, required) — Property name\\n type (BOOLEAN | TEXT | INSTANCE_SWAP, required) — Property type\\n defaultValue (string_or_boolean, required) — Default value\\n preferredValues (array, optional) — Preferred values for INSTANCE_SWAP\\n\\n ## from_node — Convert existing nodes to components. Text children auto-exposed as editable properties (exposeText: true).\\n nodeId (string, required) — Node ID to convert\\n exposeText (boolean, optional) — Auto-expose text as editable properties (default: true)\\n\\n ## variant_set — Combine components into a variant set. The resulting set is a frame — accepts all frame properties for layout/styling.\\n name (string, optional) — Node name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width (default: 100)\\n height (number, optional) — Height (default: 100)\\n rotation (number, optional) — Rotation in degrees (0-360)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n componentIds (string[], required) — Component IDs to combine (min 2)\\n variantPropertyName (string, optional) — Rename the auto-generated variant property (default: 'Property 1')\",\n \"update\": \"# components.update\\nAdd, edit, or delete component properties\\n\\nExample: components(method:\\\"update\\\", items:[{id:\\\"1:23\\\", propertyName:\\\"Label\\\", action:\\\"edit\\\", defaultValue:\\\"Click Me\\\"}])\\n\\nParams:\\n items (UpdatePropertyItem[], required) — Array of {id, propertyName, action?, type?, defaultValue?, name?, preferredValues?}\\n id (string, required) — Component or component set ID\\n propertyName (string, required) — Property name with #suffix for edit/delete (e.g. \\\"Label#1:0\\\"). Call components.get to find exact keys. For add, plain name works.\\n action (add | edit | delete | rename_variant, optional) — \\\"add\\\" (default): requires type + defaultValue. \\\"edit\\\": pass defaultValue to change default, name to rename property. \\\"delete\\\": just propertyName. \\\"rename_variant\\\": pass defaultValue=current option name, name=new option name.\\n type (BOOLEAN | TEXT | INSTANCE_SWAP | VARIANT, optional) — Property type (required for add)\\n defaultValue (string_or_boolean, optional) — Default value (add/edit). For rename_variant: the CURRENT option name to rename\\n name (string, optional) — New name — for edit: renames the property itself, for rename_variant: the new option value name\\n preferredValues (array, optional) — Preferred values for INSTANCE_SWAP\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"delete\": \"# components.delete\\nDelete components or component sets\\n\\nParams:\\n id (string, required) — Component or component set ID\"\n }\n },\n \"connection\": {\n \"summary\": \"# connection\\nManage the Figma plugin connection.\\n\\nMethods:\\n create Join a relay channel (required first step before any other tool) [read]\\n get Verify end-to-end connection to Figma [read]\\n list Inspect which clients (MCP, plugin) are connected to each channel [read]\\n delete Disconnect all clients (MCP server and Figma plugin) from a channel and reset its state [edit]\\n\\n// Connection manages the WebSocket link between the MCP server and the Figma plugin.\\n// Channels are named rooms — both the MCP server and Figma plugin must join the same channel to communicate.\\n// Workflow: connection(method:\\\"create\\\") to join a channel → connection(method:\\\"get\\\") to verify Figma plugin is connected.\\n// If get times out (5s), the Figma plugin is not running or not on the same channel.\\n// list shows all active channels and their connected clients. delete factory-resets a channel.\\n\\nUse connection(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"create\": \"# connection.create\\nJoin a relay channel (required first step before any other tool)\\n\\nParams:\\n channel (string, optional) — The channel name displayed in the Figma plugin panel. Defaults to 'vibma' if omitted.\",\n \"get\": \"# connection.get\\nVerify end-to-end connection to Figma\\n\\nNo params.\",\n \"list\": \"# connection.list\\nInspect which clients (MCP, plugin) are connected to each channel\\n\\nNo params.\",\n \"delete\": \"# connection.delete\\nDisconnect all clients (MCP server and Figma plugin) from a channel and reset its state\\n\\nParams:\\n channel (string, optional) — Channel to reset. Defaults to 'vibma'.\"\n }\n },\n \"document\": {\n \"summary\": \"# document\\nNavigate and manage Figma pages (canvases) in the document.\\n\\nMethods:\\n get Get current page with top-level children [read]\\n list Get document name and list all pages [read]\\n set Switch to a page by ID or name. At least one of pageId or pageName must be provided. [read]\\n create Create a new page [create]\\n update Rename a page [edit]\\n\\n// A Figma document contains pages — each page is an independent canvas with its own node tree.\\n// The \\\"current page\\\" is where all node operations happen. Use document.set to switch pages before working with nodes.\\n// Page IDs look like \\\"0:1\\\", \\\"1:1\\\", etc. The first page is always \\\"0:1\\\".\\n// get returns the current page with its top-level children as stubs. list returns all pages in the document.\\n\\nUse document(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"get\": \"# document.get\\nGet current page with top-level children\\n\\nNo params.\",\n \"list\": \"# document.list\\nGet document name and list all pages\\n\\nNo params.\",\n \"set\": \"# document.set\\nSwitch to a page by ID or name. At least one of pageId or pageName must be provided.\\n\\nParams:\\n pageId (string, optional) — Page ID\\n pageName (string, optional) — Page name (case-insensitive, substring match)\",\n \"create\": \"# document.create\\nCreate a new page\\n\\nParams:\\n name (string, optional) — Page name (default: 'New Page')\",\n \"update\": \"# document.update\\nRename a page\\n\\nParams:\\n newName (string, required) — New page name\\n pageId (string, optional) — Page ID (default: current page)\"\n }\n },\n \"fonts\": {\n \"summary\": \"# fonts\\nSearch available fonts in Figma.\\n\\nMethods:\\n list List available font families, optionally filtered by name [read]\\n\\n// Returns font family names installed in the Figma environment. Use to verify a fontFamily before text.create or styles.create.\\n// query filters by family name substring (case-insensitive), e.g. query:\\\"inter\\\" matches \\\"Inter\\\", \\\"Inter Tight\\\".\\n// ---\\n// Default response: just family names. Set includeStyles:true to also get available styles per family (e.g. \\\"Regular\\\", \\\"Bold\\\", \\\"Italic\\\").\\n// Use fonts.list with query to narrow results before creating text with specific fontFamily + fontStyle.\\n\\nUse fonts(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"list\": \"# fonts.list\\nList available font families, optionally filtered by name\\n\\nExample: fonts(method:\\\"list\\\", query:\\\"inter\\\")\\n\\nParams:\\n query (string, optional) — Filter by family name (case-insensitive substring)\\n includeStyles (boolean, optional) — Include available styles per family (default: false)\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\"\n }\n },\n \"frames\": {\n \"summary\": \"# frames\\nCreate and manage frames, shapes, auto-layout containers, sections, and SVG nodes.\\n\\nMethods:\\n get Get serialized node data [read]\\n list Search for nodes (returns stubs only — use get with depth for full properties) [read]\\n update Patch node properties [edit]\\n delete Delete nodes [edit]\\n clone Duplicate nodes [create]\\n audit Run lint on a node — returns severity-ranked findings [read]\\n reparent Move nodes into a new parent [edit]\\n create Create frame-like containers [create]\\n export Export a node as PNG, JPG, SVG, SVG_STRING, or PDF [read]\\n\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\\n// ---\\n// visible: false hides the node. Omitted from response when true (the default).\\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\\n// rotation: degrees (0-360). Omitted when 0.\\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\\n// bindings: bind design variables to node properties. field uses slash path: \\\"fills/0/color\\\" (first fill), \\\"strokes/0/color\\\", \\\"opacity\\\", \\\"width\\\", \\\"height\\\", \\\"cornerRadius\\\", \\\"paddingLeft\\\", \\\"itemSpacing\\\".\\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\\n// properties: escape hatch — set any Figma node property directly. Use only when no dedicated field exists.\\ninterface Node {\\n id: string; name: string; type: string;\\n visible?: boolean; // omitted when true\\n locked?: boolean; // omitted when false\\n opacity?: number; // omitted when 1\\n rotation?: number; // omitted when 0\\n blendMode?: string; // omitted when PASS_THROUGH\\n layoutPositioning?: \\\"AUTO\\\" | \\\"ABSOLUTE\\\";\\n layoutSizingHorizontal?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n layoutSizingVertical?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\\n fills?: Paint[]; // solid: {type: \\\"SOLID\\\", color: {r, g, b, a}}\\n strokes?: Paint[];\\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\\n children?: NodeStub[]; // stubs: {id, name, type} — use depth to expand\\n}\\n// PatchItem uses flat params matching create shape — no nested sub-objects.\\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\\n// Unknown keys produce a warning, preventing silent failures.\\n// Frames are the primary container in Figma. Use auto_layout for responsive containers.\\n// Sizing: FIXED = explicit size, HUG = shrink to children, FILL = expand to fill parent.\\n// Fill: pass fills:[{type:\\\"SOLID\\\", color:\\\"#hex\\\"}] or [] for transparent. Shorthand: fillColor:\\\"#3B82F6\\\" (auto-binds to matching variable/style).\\n// Also: fillVariableName:\\\"bg/primary\\\", fillStyleName:\\\"Surface/Primary\\\".\\n// Stroke: pass strokes:[{type:\\\"SOLID\\\", color:\\\"#hex\\\"}] or [] to clear. Shorthand: strokeColor:\\\"#000\\\", strokeVariableName:\\\"border/default\\\".\\n// Token fields (cornerRadius, opacity, itemSpacing, padding, strokeWeight): pass number for value, string for variable name/ID.\\n// ---\\n// SIZING: Always think about both axes. Containers with text need a width constraint — set width + layoutSizingHorizontal:\\\"FIXED\\\".\\n// HUG/HUG is only correct for intrinsically-sized elements (buttons, badges, icons).\\n// Smart defaults inside auto-layout parent: cross-axis defaults to FILL, primary axis stays HUG.\\n// FILL only works inside an auto-layout parent. Use FIXED for top-level frames.\\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\\n// clipsContent: true (default) clips children to the frame bounds. Set false for overflow-visible.\\n// Sections are top-level organizers (like artboards) — they cannot be nested inside frames.\\n// Shape primitives: rectangle, ellipse, line — for decorative/visual elements (not containers).\\n// group: wraps existing nodes into a Group. boolean_operation: UNION/SUBTRACT/INTERSECT/EXCLUDE combines shapes.\\n// SVG create: pass raw SVG markup string (e.g. \\\"<svg>...</svg>\\\") — Figma converts it to vector nodes.\\n\\nUse frames(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"get\": \"# frames.get\\nGet serialized node data\\n\\nParams:\\n id (string, required) — Node ID\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\\n verbose (boolean, optional) — Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\",\n \"list\": \"# frames.list\\nSearch for nodes (returns stubs only — use get with depth for full properties)\\n\\nParams:\\n query (string, optional) — Name search query (case-insensitive substring match)\\n types (string[], optional) — Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\\n parentId (string, optional) — Search only within this subtree\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"update\": \"# frames.update\\nPatch node properties\\n\\nParams:\\n items (PatchItem[], required) — Array of {id, ...properties} to patch\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n fontSize (number, optional) — Font size\\n fontFamily (string, optional) — Font family\\n fontStyle (string, optional) — Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\\n fontWeight (number, optional) — 100-900. Ignored when fontStyle is set.\\n fontColor (Color, optional) — Shorthand — sets text color (auto-binds to matching variable/style)\\n fontColorVariableName (string, optional) — Bind color variable by name e.g. 'text/primary'\\n fontColorStyleName (string, optional) — Apply paint style — overrides fontColor\\n textStyleId (string, optional) — Apply text style by ID — overrides fontSize/fontWeight\\n textStyleName (string, optional) — Text style by name (case-insensitive)\\n textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)\\n textAlignVertical (TOP | CENTER | BOTTOM, optional)\\n textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)\\n id (string, required)\\n name (string, optional) — Rename node\\n rotation (number, optional) — Degrees (0-360)\\n x (number, optional)\\n y (number, optional)\\n width (number, optional)\\n height (number, optional)\\n clearFill (boolean, optional) — Remove all fills\\n effects (array, optional) — Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n constraints (object, optional)\\n bindings (array, optional) — Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.\\n field (string, required)\\n variableName (string, optional)\\n variableId (string, optional)\\n explicitMode (object, optional) — Pin variable mode — use { collectionName, modeName } (preferred) or { collectionId, modeId }\\n exportSettings (array, optional) — Export settings\\n properties (object, optional) — Direct Figma API props (escape hatch)\",\n \"delete\": \"# frames.delete\\nDelete nodes\\n\\nParams:\\n id (string, optional) — Single node ID\\n items (array, optional) — Batch: [{id}, ...]\\n id (string, optional)\",\n \"clone\": \"# frames.clone\\nDuplicate nodes\\n\\nParams:\\n id (string, required) — Node ID\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"audit\": \"# frames.audit\\nRun lint on a node — returns severity-ranked findings\\n\\nParams:\\n id (string, required) — Node ID to audit\\n rules (string[], optional) — Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\\n maxDepth (number, optional) — Max tree depth (default: 10)\\n maxFindings (number, optional) — Max findings (default: 50)\",\n \"reparent\": \"# frames.reparent\\nMove nodes into a new parent\\n\\nParams:\\n items (array, required) — Array of {id, parentId, index?}\\n id (string, required)\\n parentId (string, required)\\n index (number, optional)\",\n \"create\": \"# frames.create\\nCreate frame-like containers\\n\\nExample: frames(method:\\\"create\\\", type:\\\"auto_layout\\\", layoutMode:\\\"VERTICAL\\\", itemSpacing:16, padding:24)\\n\\nDiscriminant: type (frame | auto_layout | section | rectangle | ellipse | line | group | boolean_operation | svg)\\n\\n ## frame — Static frame with fixed dimensions\\n name (string, optional) — Node name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width (default: 100)\\n height (number, optional) — Height (default: 100)\\n rotation (number, optional) — Rotation in degrees (0-360)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n clipsContent (boolean, optional)\\n\\n ## auto_layout — Auto-layout frame that arranges children automatically\\n name (string, optional) — Node name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width (default: 100)\\n height (number, optional) — Height (default: 100)\\n rotation (number, optional) — Rotation in degrees (0-360)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (HORIZONTAL | VERTICAL, required) — Primary axis direction\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n clipsContent (boolean, optional)\\n nodeIds (string[], optional) — Existing node IDs to wrap into auto-layout\\n\\n ## section — Figma section (top-level organizer)\\n name (string, required) — Section name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width (default: 500)\\n height (number, optional) — Height (default: 500)\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n\\n ## rectangle — Rectangle shape node\\n name (string, optional) — Layer name (default: 'Rectangle')\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width in px (default: 100)\\n height (number, optional) — Height in px (default: 100)\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n opacity (string, optional)\\n layoutSizingHorizontal (FIXED | FILL, optional) — Horizontal sizing in auto-layout parent\\n layoutSizingVertical (FIXED | FILL, optional) — Vertical sizing in auto-layout parent\\n\\n ## ellipse — Ellipse/circle shape node\\n name (string, optional) — Layer name (default: 'Ellipse')\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n width (number, optional) — Width in px (default: 100)\\n height (number, optional) — Height in px (default: 100, same as width for circle)\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional)\\n opacity (string, optional)\\n layoutSizingHorizontal (FIXED | FILL, optional) — Horizontal sizing in auto-layout parent\\n layoutSizingVertical (FIXED | FILL, optional) — Vertical sizing in auto-layout parent\\n\\n ## line — Line shape node\\n name (string, optional) — Layer name (default: 'Line')\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n length (number, optional) — Line length in px (default: 100)\\n rotation (number, optional) — Rotation in degrees (default: 0 = horizontal)\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\\n strokeColor (Color, optional) — Line color (default: black, auto-binds to matching variable/style)\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — Line thickness (default: 1)\\n opacity (string, optional)\\n layoutSizingHorizontal (FIXED | FILL, optional) — Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)\\n\\n ## group — Group existing nodes together\\n nodeIds (string[], required) — Node IDs to group (min 1)\\n name (string, optional) — Group name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n\\n ## boolean_operation — Combine shapes with boolean operations (union, subtract, intersect, exclude)\\n operation (UNION | SUBTRACT | INTERSECT | EXCLUDE, required) — Boolean operation type\\n nodeIds (string[], required) — Node IDs to combine (min 2, first node is the base for SUBTRACT)\\n name (string, optional) — Result node name\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n\\n ## svg — Create node from SVG markup\\n svg (string, required) — SVG markup string\\n name (string, optional) — Layer name (default: 'SVG')\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n fillStyleName (string, optional) — Paint style to apply to vector fills\\n fillVariableName (string, optional) — Color variable by name for vector fills\\n strokeStyleName (string, optional) — Paint style to apply to vector strokes\\n strokeVariableName (string, optional) — Color variable by name for vector strokes\",\n \"export\": \"# frames.export\\nExport a node as PNG, JPG, SVG, SVG_STRING, or PDF\\n\\nParams:\\n id (string, required) — Node ID to export\\n format (PNG | JPG | SVG | SVG_STRING | PDF, optional) — Export format (default: PNG). SVG_STRING returns raw SVG text.\\n scale (number, optional) — Export scale (default: 1, only for PNG/JPG)\"\n }\n },\n \"instances\": {\n \"summary\": \"# instances\\nCreate and manage component instances.\\n\\nMethods:\\n list Search for nodes (returns stubs only — use get with depth for full properties) [read]\\n delete Delete nodes [edit]\\n clone Duplicate nodes [create]\\n audit Run lint on a node — returns severity-ranked findings [read]\\n reparent Move nodes into a new parent [edit]\\n get Get instance detail with component properties and overrides [read]\\n create Create component instances [create]\\n update Set instance properties [edit]\\n swap Swap instance component (preserves overrides) [edit]\\n detach Detach instances from their component (converts to frame) [edit]\\n reset_overrides Reset all overrides on instances to match their main component [edit]\\n\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\\n// ---\\n// visible: false hides the node. Omitted from response when true (the default).\\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\\n// rotation: degrees (0-360). Omitted when 0.\\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\\n// bindings: bind design variables to node properties. field uses slash path: \\\"fills/0/color\\\" (first fill), \\\"strokes/0/color\\\", \\\"opacity\\\", \\\"width\\\", \\\"height\\\", \\\"cornerRadius\\\", \\\"paddingLeft\\\", \\\"itemSpacing\\\".\\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\\n// properties: escape hatch — set any Figma node property directly. Use only when no dedicated field exists.\\ninterface Node {\\n id: string; name: string; type: string;\\n visible?: boolean; // omitted when true\\n locked?: boolean; // omitted when false\\n opacity?: number; // omitted when 1\\n rotation?: number; // omitted when 0\\n blendMode?: string; // omitted when PASS_THROUGH\\n layoutPositioning?: \\\"AUTO\\\" | \\\"ABSOLUTE\\\";\\n layoutSizingHorizontal?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n layoutSizingVertical?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\\n fills?: Paint[]; // solid: {type: \\\"SOLID\\\", color: {r, g, b, a}}\\n strokes?: Paint[];\\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\\n children?: NodeStub[]; // stubs: {id, name, type} — use depth to expand\\n}\\n// PatchItem uses flat params matching create shape — no nested sub-objects.\\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\\n// Unknown keys produce a warning, preventing silent failures.\\n// Instances are linked copies of components. Changes to the component propagate to all instances.\\n// Overrides: instance-level changes (text, fills, visibility) that differ from the component. Shown in overrides array.\\n// variantProperties: when creating from a component set, pick which variant e.g. {\\\"Style\\\":\\\"Secondary\\\",\\\"Size\\\":\\\"Large\\\"}.\\n// ---\\n// Property keys: read returns clean names (\\\"Label\\\"), write requires the #suffix (\\\"Label#1:0\\\"). Call instances.get(id) to discover exact keys before update.\\n// swap: change which component an instance points to while preserving compatible overrides.\\n// detach: permanently converts an instance to a regular frame, breaking the component link.\\n// reset_overrides: reverts all instance overrides to match the main component.\\n// Workflow: components.list → instances.create with componentId + properties (one call). No separate update needed for text/boolean overrides.\\n// Instances support frame-level overrides: layoutSizingHorizontal/Vertical (FIXED, FILL, HUG), opacity, width/height, min/max.\\n// Use layoutSizingHorizontal: \\\"FILL\\\" to make instances stretch in auto-layout parents.\\n\\nUse instances(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"list\": \"# instances.list\\nSearch for nodes (returns stubs only — use get with depth for full properties)\\n\\nParams:\\n query (string, optional) — Name search query (case-insensitive substring match)\\n types (string[], optional) — Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\\n parentId (string, optional) — Search only within this subtree\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"delete\": \"# instances.delete\\nDelete nodes\\n\\nParams:\\n id (string, optional) — Single node ID\\n items (array, optional) — Batch: [{id}, ...]\\n id (string, optional)\",\n \"clone\": \"# instances.clone\\nDuplicate nodes\\n\\nParams:\\n id (string, required) — Node ID\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"audit\": \"# instances.audit\\nRun lint on a node — returns severity-ranked findings\\n\\nParams:\\n id (string, required) — Node ID to audit\\n rules (string[], optional) — Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\\n maxDepth (number, optional) — Max tree depth (default: 10)\\n maxFindings (number, optional) — Max findings (default: 50)\",\n \"reparent\": \"# instances.reparent\\nMove nodes into a new parent\\n\\nParams:\\n items (array, required) — Array of {id, parentId, index?}\\n id (string, required)\\n parentId (string, required)\\n index (number, optional)\",\n \"get\": \"# instances.get\\nGet instance detail with component properties and overrides\\n\\nParams:\\n id (string, required) — Instance node ID\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\\n verbose (boolean, optional) — Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\",\n \"create\": \"# instances.create\\nCreate component instances\\n\\nExample: instances(method:\\\"create\\\", items:[{componentId:\\\"1:23\\\", variantProperties:{\\\"Size\\\":\\\"Large\\\"}, properties:{\\\"Label\\\":\\\"Click me\\\"}, parentId:\\\"2:45\\\", layoutSizingHorizontal:\\\"FILL\\\"}])\\n\\nParams:\\n items (InstanceCreateItem[], required) — Array of {componentId, variantProperties?, x?, y?, parentId?, layoutSizingHorizontal?, ...}\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n componentId (string, required) — Component or component set ID\\n variantProperties (object, optional) — Pick variant e.g. {\\\"Style\\\":\\\"Secondary\\\"}\\n properties (object, optional) — Set component properties inline e.g. {\\\"Label\\\":\\\"Click me\\\", \\\"ShowIcon\\\":true}. Same as instances.update properties.\\n name (string, optional) — Instance layer name\\n x (number, optional)\\n y (number, optional)\\n width (number, optional) — Override width (resize)\\n height (number, optional) — Override height (resize)\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"update\": \"# instances.update\\nSet instance properties\\n\\nExample: instances(method:\\\"update\\\", items:[{id:\\\"1:23\\\", properties:{\\\"Label#4:0\\\":\\\"Submit\\\"}, fillColor:\\\"#3B82F6\\\", layoutSizingHorizontal:\\\"FILL\\\"}])\\n\\nParams:\\n items (InstanceUpdateItem[], required) — Array of {id, properties: {\\\"Label#1:0\\\":\\\"text\\\"}, fillColor?: ...}\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n fontSize (number, optional) — Font size\\n fontFamily (string, optional) — Font family\\n fontStyle (string, optional) — Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\\n fontWeight (number, optional) — 100-900. Ignored when fontStyle is set.\\n fontColor (Color, optional) — Shorthand — sets text color (auto-binds to matching variable/style)\\n fontColorVariableName (string, optional) — Bind color variable by name e.g. 'text/primary'\\n fontColorStyleName (string, optional) — Apply paint style — overrides fontColor\\n textStyleId (string, optional) — Apply text style by ID — overrides fontSize/fontWeight\\n textStyleName (string, optional) — Text style by name (case-insensitive)\\n textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)\\n textAlignVertical (TOP | CENTER | BOTTOM, optional)\\n textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)\\n id (string, required) — Instance node ID\\n properties (object, optional) — Component property key→value map\\n componentProperties (object, optional) — Alias for properties (matches instances.get response shape)\\n name (string, optional) — Rename node\\n rotation (number, optional) — Degrees (0-360)\\n x (number, optional)\\n y (number, optional)\\n width (number, optional)\\n height (number, optional)\\n clearFill (boolean, optional) — Remove all fills\\n effects (array, optional) — Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)\\n constraints (object, optional)\\n bindings (array, optional) — Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.\\n field (string, required)\\n variableName (string, optional)\\n variableId (string, optional)\\n explicitMode (object, optional) — Pin variable mode — use { collectionName, modeName } (preferred) or { collectionId, modeId }\\n exportSettings (array, optional) — Export settings\",\n \"swap\": \"# instances.swap\\nSwap instance component (preserves overrides)\\n\\nParams:\\n items (array, required) — Array of {id, componentId}\\n id (string, required) — Instance node ID\\n componentId (string, required) — New component or component set ID\",\n \"detach\": \"# instances.detach\\nDetach instances from their component (converts to frame)\\n\\nParams:\\n items (array, required) — Array of {id}\\n id (string, required) — Instance node ID\",\n \"reset_overrides\": \"# instances.reset_overrides\\nReset all overrides on instances to match their main component\\n\\nParams:\\n items (array, required) — Array of {id}\\n id (string, required) — Instance node ID\"\n }\n },\n \"lint\": {\n \"summary\": \"# lint\\nRun design quality and accessibility checks.\\n\\nMethods:\\n check Run design linter on a node tree [read]\\n fix Auto-fix frames to auto-layout [edit]\\n\\n// Lint runs automated design quality and accessibility checks on a node tree.\\n// ---\\n// Rules: \\\"all\\\" (default), or filter by category or specific rule names.\\n// Category meta-rules (expand to all rules in that category):\\n// \\\"component\\\" — component property binding checks\\n// \\\"composition\\\" — layout and positioning checks\\n// \\\"token\\\" — design token / style usage checks\\n// \\\"naming\\\" — layer naming checks\\n// \\\"wcag\\\" / \\\"accessibility\\\" — all WCAG accessibility checks\\n// ---\\n// Severity levels (output is sorted by severity, highest first):\\n// \\\"error\\\" — definite bug, must fix\\n// \\\"unsafe\\\" — likely causes layout/accessibility problems\\n// \\\"heuristic\\\" — probably worth fixing, context-dependent\\n// \\\"style\\\" — opinionated, nice-to-have (leaf nodes, decorative elements often downgraded here)\\n// Context-aware: leaf nodes (text, shapes, small frames) are treated differently from containers.\\n// Small labels with HUG sizing, leaf nodes on cross-axis — downgraded to \\\"style\\\" instead of \\\"heuristic\\\".\\n// Per-finding severity overrides appear on individual nodes when context changes the default.\\n// ---\\n// Component rules [component]:\\n// \\\"no-text-property\\\" — component text not exposed as editable property [heuristic]\\n// \\\"component-bindings\\\" — unbound text, orphaned properties, unexposed nested text [heuristic; orphaned→unsafe, nested→style]\\n// Composition rules [composition]:\\n// \\\"no-autolayout\\\" — frames with manually positioned children [heuristic; leaf-only containers→style]\\n// \\\"overlapping-children\\\" — children stacked at same position [heuristic]\\n// \\\"shape-instead-of-frame\\\" — shapes used as containers [style]\\n// \\\"fixed-in-autolayout\\\" — FIXED-size children in auto-layout parents [heuristic]\\n// \\\"unbounded-hug\\\" — HUG on both axes [unsafe; short leaf text→style]\\n// \\\"hug-cross-axis\\\" — HUG on cross-axis of constrained parent [heuristic; leaf nodes→style]\\n// \\\"empty-container\\\" — empty frames [style]\\n// Token rules [token]:\\n// \\\"hardcoded-color\\\" — colors not using styles or variables [heuristic]\\n// \\\"hardcoded-token\\\" — numeric values not bound to FLOAT variable [heuristic]\\n// \\\"no-text-style\\\" — text without a text style [heuristic]\\n// Naming rules [naming]:\\n// \\\"default-name\\\" — default names like \\\"Frame 1\\\" [style]\\n// \\\"stale-text-name\\\" — text node name doesn't match content [style]\\n// Accessibility rules [wcag]:\\n// \\\"wcag-contrast\\\" — AA contrast ratio [unsafe]\\n// \\\"wcag-contrast-enhanced\\\" — AAA contrast ratio [style]\\n// \\\"wcag-non-text-contrast\\\" — non-text 3:1 contrast [heuristic]\\n// \\\"wcag-target-size\\\" — targets below 24x24px [unsafe]\\n// \\\"wcag-text-size\\\" — text below 12px [unsafe]\\n// \\\"wcag-line-height\\\" — line height below 1.5x [style]\\n// ---\\n// maxDepth limits how deep the tree traversal goes (default: 10). maxFindings caps total findings (default: 50).\\n// fix: auto-converts frames to auto-layout. Use after lint.check identifies \\\"no-autolayout\\\" issues.\\n\\nUse lint(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"check\": \"# lint.check\\nRun design linter on a node tree\\n\\nExample: lint(method:\\\"check\\\", nodeId:\\\"0:1\\\", rules:[\\\"wcag\\\",\\\"hardcoded-color\\\"])\\n\\nParams:\\n nodeId (string, optional) — Node ID to lint. If omitted: 1 selected node → lints that node, 2+ selected → lints entire page (not the selection), 0 selected → error. Always pass nodeId explicitly for reliable targeting.\\n rules (string[], optional) — Rules to run. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\"/\\\"accessibility\\\". Or specific rule names.\\n maxDepth (number, optional) — Max tree depth (default: 10)\\n maxFindings (number, optional) — Max findings (default: 50)\",\n \"fix\": \"# lint.fix\\nAuto-fix frames to auto-layout\\n\\nParams:\\n items (array, required) — Array of {nodeId, layoutMode?, itemSpacing?}\\n nodeId (string, required) — Frame node ID\\n layoutMode (VERTICAL | HORIZONTAL, optional) — Direction (default: auto-detected)\\n itemSpacing (number, optional) — Spacing between children\\n depth (number, optional) — Response detail for fixed nodes: omit for stubs, 0=properties, -1=full tree\"\n }\n },\n \"prototyping\": {\n \"summary\": \"# prototyping\\nManage prototype interactions, reactions, and navigation flows.\\n\\nMethods:\\n get Get reactions and overflow direction on a node [read]\\n add Add a prototype reaction to a node [edit]\\n set Replace all reactions on a node (raw reactions array) [edit]\\n remove Remove a reaction from a node by index [edit]\\n\\n// Reactions wire up interactions: trigger (ON_CLICK, ON_HOVER, ...) → action (navigate, swap, overlay).\\n// Common patterns: button ON_CLICK → NAVIGATE to detail frame; card ON_HOVER → CHANGE_TO hover variant.\\n// Multi-action: pass actions[] array to run multiple actions on one trigger (e.g. navigate + set variable mode).\\n// ---\\n// TRIGGERS: ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT(timeout) | MOUSE_ENTER(delay) | MOUSE_LEAVE(delay) | ON_KEY_DOWN(keyCodes)\\n// NAVIGATION: NAVIGATE (go to frame) | SWAP (swap overlay) | OVERLAY (show overlay) | SCROLL_TO | CHANGE_TO (swap component variant)\\n// TRANSITIONS: DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT (+ direction for directional)\\n// EASING: EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW\\n// ACTIONS: NODE (navigate/swap) | BACK (go back) | CLOSE (close overlay) | URL (open link) | SET_VARIABLE_MODE (switch theme/mode)\\n\\nUse prototyping(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"get\": \"# prototyping.get\\nGet reactions and overflow direction on a node\\n\\nParams:\\n id (string, required) — Node ID\",\n \"add\": \"# prototyping.add\\nAdd a prototype reaction to a node\\n\\nExample: prototyping(method:\\\"add\\\", id:\\\"btn-1\\\", trigger:\\\"ON_CLICK\\\", destination:\\\"detail-frame-id\\\", navigation:\\\"NAVIGATE\\\")\\n\\nParams:\\n id (string, required) — Node ID\\n trigger (ON_CLICK | ON_HOVER | ON_PRESS | ON_DRAG | AFTER_TIMEOUT | MOUSE_ENTER | MOUSE_LEAVE | ON_KEY_DOWN, required) — Trigger type\\n triggerDelay (number, optional) — Delay in ms for AFTER_TIMEOUT / MOUSE_ENTER / MOUSE_LEAVE triggers\\n triggerKeyCodes (number[], optional) — Key codes for ON_KEY_DOWN trigger\\n triggerDevice (KEYBOARD | XBOX_ONE | PS4 | SWITCH_PRO, optional) — Device for ON_KEY_DOWN (default: KEYBOARD)\\n destination (string, optional) — Target node ID (required for NODE actions)\\n navigation (NAVIGATE | SWAP | OVERLAY | SCROLL_TO | CHANGE_TO, optional) — Navigation type (default: NAVIGATE)\\n transition (DISSOLVE | SMART_ANIMATE | MOVE_IN | MOVE_OUT | PUSH | SLIDE_IN | SLIDE_OUT | INSTANT, optional) — Transition animation (default: DISSOLVE). INSTANT = no animation.\\n transitionDirection (LEFT | RIGHT | TOP | BOTTOM, optional) — Direction for MOVE_IN, MOVE_OUT, PUSH, SLIDE_IN, SLIDE_OUT\\n duration (number, optional) — Transition duration in seconds (default: 0.3)\\n easing (EASE_IN | EASE_OUT | EASE_IN_AND_OUT | LINEAR | GENTLE | QUICK | BOUNCY | SLOW, optional) — Easing function (default: EASE_OUT)\\n actionType (NODE | BACK | CLOSE | URL | SET_VARIABLE_MODE, optional) — Action type (default: NODE). SET_VARIABLE_MODE switches a variable collection mode.\\n url (string, optional) — URL for URL action type\\n collectionName (string, optional) — Variable collection name (for SET_VARIABLE_MODE)\\n modeName (string, optional) — Mode name to switch to (for SET_VARIABLE_MODE)\\n resetScrollPosition (boolean, optional) — Reset scroll position on navigate (default: true)\\n actions (array, optional) — Multi-action: [{actionType, destination?, navigation?, collectionName?, modeName?, ...}]. Overrides single-action params.\",\n \"set\": \"# prototyping.set\\nReplace all reactions on a node (raw reactions array)\\n\\nParams:\\n id (string, required) — Node ID\\n reactions (array, required) — Full reactions array — [{trigger:{type}, actions:[{type, destinationId, navigation, transition}]}]\",\n \"remove\": \"# prototyping.remove\\nRemove a reaction from a node by index\\n\\nParams:\\n id (string, required) — Node ID\\n index (number, required) — Reaction index (0-based)\"\n }\n },\n \"selection\": {\n \"summary\": \"# selection\\nRead and set the current Figma selection.\\n\\nMethods:\\n get Get the current selection [read]\\n set Set selection to nodes and scroll viewport to show them [read]\\n\\n// Selection is the set of nodes currently highlighted in the Figma canvas.\\n// get returns the current selection. Without depth, returns stubs ({id, name, type}). With depth=0, returns full properties.\\n// _truncated: true when the response was cut short due to node budget limits. Use depth=0 or specific fields to reduce payload.\\n// set replaces the entire selection AND scrolls the viewport to show the selected nodes.\\n\\nUse selection(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"get\": \"# selection.get\\nGet the current selection\\n\\nParams:\\n depth (number, optional) — Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited.\\n verbose (boolean, optional) — Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\",\n \"set\": \"# selection.set\\nSet selection to nodes and scroll viewport to show them\\n\\nParams:\\n nodeIds (string[], required) — Array of node IDs to select. Example: [\\\"1:2\\\",\\\"1:3\\\"]\"\n }\n },\n \"styles\": {\n \"summary\": \"# styles\\nCRUD for local paint, text, effect, and grid styles.\\n\\nMethods:\\n list List local styles with optional type filter [read]\\n get Get full style detail by ID [read]\\n create Create local styles [create]\\n update Update styles by ID or name [edit]\\n delete Delete styles [edit]\\n\\n// Styles are named, reusable design properties that can be applied to nodes. Four types:\\n// paint: a named color (applied to fills/strokes), text: typography settings, effect: shadows/blurs, grid: layout grids.\\n// All ID params accept both IDs and display names (case-insensitive). Use whichever you have.\\n// ---\\n// leadingTrim: \\\"CAP_HEIGHT\\\" trims line-height to cap height (tighter text boxes), \\\"NONE\\\" is default.\\n// fontStyle: font variant name like \\\"Bold\\\", \\\"Italic\\\", \\\"Bold Italic\\\". Use fonts.list to find available styles.\\n//\\n// Effect object shape (for effect styles):\\n// { type: \\\"DROP_SHADOW\\\"|\\\"INNER_SHADOW\\\"|\\\"LAYER_BLUR\\\"|\\\"BACKGROUND_BLUR\\\",\\n// color?: Color, offset?: {x, y}, radius: number, spread?: number,\\n// visible?: boolean, blendMode?: string }\\n// DROP_SHADOW/INNER_SHADOW require color, offset, radius. LAYER_BLUR/BACKGROUND_BLUR require radius only.\\n// Example: { type: \\\"DROP_SHADOW\\\", color: \\\"#00000040\\\", offset: {x:0,y:4}, radius: 8 }\\n//\\n// LayoutGrid object shape (for grid styles):\\n// Rows/Columns: { pattern: \\\"ROWS\\\"|\\\"COLUMNS\\\", alignment: \\\"MIN\\\"|\\\"MAX\\\"|\\\"STRETCH\\\"|\\\"CENTER\\\",\\n// gutterSize: number, count: number, sectionSize?: number, offset?: number, visible?: boolean, color?: Color }\\n// Grid: { pattern: \\\"GRID\\\", sectionSize: number, visible?: boolean, color?: Color }\\n// Example: { pattern: \\\"COLUMNS\\\", alignment: \\\"STRETCH\\\", gutterSize: 20, count: 12, offset: 40 }\\n\\nUse styles(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"list\": \"# styles.list\\nList local styles with optional type filter\\n\\nParams:\\n type (paint | text | effect | grid, optional) — Filter by style type\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"get\": \"# styles.get\\nGet full style detail by ID\\n\\nParams:\\n id (string, required) — Style ID or name\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\",\n \"create\": \"# styles.create\\nCreate local styles\\n\\nExample: styles(method:\\\"create\\\", type:\\\"effect\\\", name:\\\"Shadow/Medium\\\", effects:[{type:\\\"DROP_SHADOW\\\", color:\\\"#00000040\\\", offset:{x:0,y:4}, radius:8}])\\n\\nDiscriminant: type (paint | text | effect | grid)\\n\\n ## paint — Paint/color style\\n name (string, required) — Style name\\n color (Color, required) — Color value\\n colorVariableName (string, optional) — Bind to a COLOR variable by name (style tracks the variable)\\n description (string, optional) — Style description\\n\\n ## text — Text style\\n name (string, required) — Style name\\n fontFamily (string, required) — Font family\\n fontStyle (string, optional) — Font style (default: Regular)\\n fontSize (number, required) — Font size\\n lineHeight (line_height, optional)\\n letterSpacing (letter_spacing, optional)\\n textCase (ORIGINAL | UPPER | LOWER | TITLE | SMALL_CAPS | SMALL_CAPS_FORCED, optional)\\n textDecoration (NONE | UNDERLINE | STRIKETHROUGH, optional)\\n paragraphIndent (number, optional) — Paragraph indent (px)\\n paragraphSpacing (number, optional) — Paragraph spacing (px)\\n leadingTrim (CAP_HEIGHT | NONE, optional) — Leading trim mode\\n description (string, optional) — Style description\\n\\n ## effect — Effect style\\n name (string, required) — Style name\\n effects (array, required) — Array of Effect objects\\n description (string, optional) — Style description\\n\\n ## grid — Grid/layout grid style\\n name (string, required) — Style name\\n layoutGrids (array, required) — Array of LayoutGrid objects\\n description (string, optional) — Style description\",\n \"update\": \"# styles.update\\nUpdate styles by ID or name\\n\\nExample: styles(method:\\\"update\\\", items:[{id:\\\"Surface/Primary\\\", color:\\\"#F5F5F5\\\"}])\\n\\nParams:\\n type (paint | text | effect | grid, optional) — Style type hint for strict validation (optional, auto-detected)\\n items (PatchStyleItem[], required) — Array of {id, ...fields} to update\\n id (string, required) — Style ID or name\\n name (string, optional) — Rename the style\\n description (string, optional) — Style description\\n color (Color, optional) — New color (paint styles)\\n colorVariableName (string, optional) — Bind to a COLOR variable by name (paint styles)\\n fontFamily (string, optional)\\n fontStyle (string, optional)\\n fontSize (number, optional)\\n lineHeight (line_height, optional)\\n letterSpacing (letter_spacing, optional)\\n textCase (ORIGINAL | UPPER | LOWER | TITLE | SMALL_CAPS | SMALL_CAPS_FORCED, optional)\\n textDecoration (NONE | UNDERLINE | STRIKETHROUGH, optional)\\n paragraphIndent (number, optional) — Paragraph indent (px)\\n paragraphSpacing (number, optional) — Paragraph spacing (px)\\n leadingTrim (CAP_HEIGHT | NONE, optional)\\n effects (array, optional) — Array of Effect objects\\n layoutGrids (array, optional) — Array of LayoutGrid objects (grid styles)\",\n \"delete\": \"# styles.delete\\nDelete styles\\n\\nParams:\\n id (string, optional) — Style ID or name\\n items (array, optional) — Batch: [{id}, ...]\\n id (string, required) — Style ID or name\"\n }\n },\n \"text\": {\n \"summary\": \"# text\\nCreate and manage text nodes.\\n\\nMethods:\\n get Get serialized node data [read]\\n list Search for nodes (returns stubs only — use get with depth for full properties) [read]\\n update Patch node properties [edit]\\n delete Delete nodes [edit]\\n clone Duplicate nodes [create]\\n audit Run lint on a node — returns severity-ranked findings [read]\\n reparent Move nodes into a new parent [edit]\\n create Create text nodes [create]\\n set_content Replace text content on existing text nodes [edit]\\n scan Scan all text nodes within a subtree [read]\\n\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\\n// ---\\n// visible: false hides the node. Omitted from response when true (the default).\\n// locked: true prevents editing in Figma UI. Omitted when false (the default).\\n// rotation: degrees (0-360). Omitted when 0.\\n// blendMode: layer blend mode. Omitted when PASS_THROUGH (the default).\\n// layoutPositioning: ABSOLUTE = floating inside auto-layout parent. Omitted when AUTO (the default).\\n// minWidth/maxWidth/minHeight/maxHeight: responsive constraints for auto-layout children.\\n// constraints: position behavior in non-auto-layout parents. Ignored inside auto-layout frames.\\n// bindings: bind design variables to node properties. field uses slash path: \\\"fills/0/color\\\" (first fill), \\\"strokes/0/color\\\", \\\"opacity\\\", \\\"width\\\", \\\"height\\\", \\\"cornerRadius\\\", \\\"paddingLeft\\\", \\\"itemSpacing\\\".\\n// explicitMode: pin a variable mode on this node. Use { collectionName, modeName } (preferred) or { collectionId, modeId }.\\n// properties: escape hatch — set any Figma node property directly. Use only when no dedicated field exists.\\ninterface Node {\\n id: string; name: string; type: string;\\n visible?: boolean; // omitted when true\\n locked?: boolean; // omitted when false\\n opacity?: number; // omitted when 1\\n rotation?: number; // omitted when 0\\n blendMode?: string; // omitted when PASS_THROUGH\\n layoutPositioning?: \\\"AUTO\\\" | \\\"ABSOLUTE\\\";\\n layoutSizingHorizontal?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n layoutSizingVertical?: \\\"FIXED\\\" | \\\"HUG\\\" | \\\"FILL\\\";\\n minWidth?: number; maxWidth?: number; minHeight?: number; maxHeight?: number;\\n absoluteBoundingBox: { x: number; y: number; width: number; height: number };\\n fills?: Paint[]; // solid: {type: \\\"SOLID\\\", color: {r, g, b, a}}\\n strokes?: Paint[];\\n effects?: Effect[]; // DROP_SHADOW | INNER_SHADOW | LAYER_BLUR | BACKGROUND_BLUR\\n children?: NodeStub[]; // stubs: {id, name, type} — use depth to expand\\n}\\n// PatchItem uses flat params matching create shape — no nested sub-objects.\\n// Fill/stroke/corner/layout/text params are identical to frames.create and text.create.\\n// Unknown keys produce a warning, preventing silent failures.\\n// Text nodes display text content with typography styling. They inherit node methods (get, list, update, delete, clone, reparent).\\n// textAutoResize: NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis).\\n// Prefer textStyleName for typography, fontColorVariableName/fontColorStyleName for color.\\n// Aliases: fillColor → fontColor, fillVariableName → fontColorVariableName, fillStyleName → fontColorStyleName (consistent with frames API).\\n// ---\\n// Smart defaults inside auto-layout parent: layoutSizingHorizontal defaults to FILL, layoutSizingVertical to HUG, textAutoResize to HEIGHT.\\n// Text fills parent width and wraps automatically. Override with explicit values if needed.\\n// fontStyle vs fontWeight: fontStyle is a named variant like \\\"Bold\\\", \\\"Italic\\\", \\\"SemiBold\\\". When set, fontWeight is ignored.\\n// Use fonts.list to find available fontFamily + fontStyle combinations.\\n// scan: finds all text nodes in a subtree. path (when includePath:true) shows the layer hierarchy e.g. \\\"Frame > Card > Label\\\".\\n// ScanResult (per-item): { nodeId, count, truncated, textNodes: [{ id, name, characters, fontSize, fontFamily, fontStyle, path?, depth?, absoluteX?, absoluteY?, width?, height? }] }\\n\\nUse text(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"get\": \"# text.get\\nGet serialized node data\\n\\nParams:\\n id (string, required) — Node ID\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\\n verbose (boolean, optional) — Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\",\n \"list\": \"# text.list\\nSearch for nodes (returns stubs only — use get with depth for full properties)\\n\\nParams:\\n query (string, optional) — Name search query (case-insensitive substring match)\\n types (string[], optional) — Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\\n parentId (string, optional) — Search only within this subtree\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"update\": \"# text.update\\nPatch node properties\\n\\nParams:\\n items (PatchItem[], required) — Array of {id, ...properties} to patch\\n fills (array, optional) — Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\\n fillColor (Color, optional) — Shorthand — sets a single solid fill (auto-binds to matching variable/style)\\n fillStyleName (string, optional) — Paint style name for fill\\n fillVariableName (string, optional) — Color variable by name e.g. 'bg/primary'\\n strokes (array, optional) — Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\\n strokeColor (Color, optional) — Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\\n strokeStyleName (string, optional) — Paint style name for stroke\\n strokeVariableName (string, optional) — Color variable by name for stroke\\n strokeWeight (string, optional) — All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\\n strokeTopWeight (string, optional)\\n strokeBottomWeight (string, optional)\\n strokeLeftWeight (string, optional)\\n strokeRightWeight (string, optional)\\n strokeAlign (INSIDE | OUTSIDE | CENTER, optional) — Stroke position (default: INSIDE)\\n strokesIncludedInLayout (boolean, optional) — Include stroke width in layout measurements (default: false)\\n cornerRadius (string, optional) — All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\\n topLeftRadius (string, optional)\\n topRightRadius (string, optional)\\n bottomRightRadius (string, optional)\\n bottomLeftRadius (string, optional)\\n opacity (string, optional) — Opacity (0-1) or variable name\\n visible (boolean, optional) — Show/hide (default true)\\n locked (boolean, optional) — Lock/unlock (default false)\\n blendMode (PASS_THROUGH | NORMAL | DARKEN | MULTIPLY | LINEAR_BURN | COLOR_BURN | LIGHTEN | SCREEN | LINEAR_DODGE | COLOR_DODGE | OVERLAY | SOFT_LIGHT | HARD_LIGHT | DIFFERENCE | EXCLUSION | HUE | SATURATION | COLOR | LUMINOSITY, optional)\\n effectStyleName (string, optional) — Effect style name (e.g. 'Shadow/Card') for shadows, blurs\\n layoutMode (NONE | HORIZONTAL | VERTICAL, optional) — Layout direction (default: NONE)\\n layoutWrap (NO_WRAP | WRAP, optional)\\n padding (string, optional) — All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\\n paddingTop (string, optional)\\n paddingRight (string, optional)\\n paddingBottom (string, optional)\\n paddingLeft (string, optional)\\n primaryAxisAlignItems (MIN | MAX | CENTER | SPACE_BETWEEN, optional)\\n counterAxisAlignItems (MIN | MAX | CENTER | BASELINE, optional)\\n itemSpacing (string, optional) — Spacing between children (number or variable name string, default: 0)\\n counterAxisSpacing (string, optional) — Gap between wrapped rows (requires layoutWrap: WRAP)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n layoutPositioning (AUTO | ABSOLUTE, optional) — ABSOLUTE = floating inside auto-layout parent\\n minWidth (number, optional) — Min width for responsive auto-layout\\n maxWidth (number, optional) — Max width for responsive auto-layout\\n minHeight (number, optional) — Min height for responsive auto-layout\\n maxHeight (number, optional) — Max height for responsive auto-layout\\n fontSize (number, optional) — Font size\\n fontFamily (string, optional) — Font family\\n fontStyle (string, optional) — Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\\n fontWeight (number, optional) — 100-900. Ignored when fontStyle is set.\\n fontColor (Color, optional) — Shorthand — sets text color (auto-binds to matching variable/style)\\n fontColorVariableName (string, optional) — Bind color variable by name e.g. 'text/primary'\\n fontColorStyleName (string, optional) — Apply paint style — overrides fontColor\\n textStyleId (string, optional) — Apply text style by ID — overrides fontSize/fontWeight\\n textStyleName (string, optional) — Text style by name (case-insensitive)\\n textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)\\n textAlignVertical (TOP | CENTER | BOTTOM, optional)\\n textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional)\\n id (string, required)\\n name (string, optional) — Rename node\\n rotation (number, optional) — Degrees (0-360)\\n x (number, optional)\\n y (number, optional)\\n width (number, optional)\\n height (number, optional)\\n clearFill (boolean, optional) — Remove all fills\\n effects (array, optional) — Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)\\n overflowDirection (NONE | HORIZONTAL | VERTICAL | BOTH, optional) — Scroll overflow in prototype (default: NONE)\\n constraints (object, optional)\\n bindings (array, optional) — Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.\\n field (string, required)\\n variableName (string, optional)\\n variableId (string, optional)\\n explicitMode (object, optional) — Pin variable mode — use { collectionName, modeName } (preferred) or { collectionId, modeId }\\n exportSettings (array, optional) — Export settings\\n properties (object, optional) — Direct Figma API props (escape hatch)\",\n \"delete\": \"# text.delete\\nDelete nodes\\n\\nParams:\\n id (string, optional) — Single node ID\\n items (array, optional) — Batch: [{id}, ...]\\n id (string, optional)\",\n \"clone\": \"# text.clone\\nDuplicate nodes\\n\\nParams:\\n id (string, required) — Node ID\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n x (number, optional) — X position (default: 0)\\n y (number, optional) — Y position (default: 0)\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"audit\": \"# text.audit\\nRun lint on a node — returns severity-ranked findings\\n\\nParams:\\n id (string, required) — Node ID to audit\\n rules (string[], optional) — Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\\n maxDepth (number, optional) — Max tree depth (default: 10)\\n maxFindings (number, optional) — Max findings (default: 50)\",\n \"reparent\": \"# text.reparent\\nMove nodes into a new parent\\n\\nParams:\\n items (array, required) — Array of {id, parentId, index?}\\n id (string, required)\\n parentId (string, required)\\n index (number, optional)\",\n \"create\": \"# text.create\\nCreate text nodes\\n\\nExample: text(method:\\\"create\\\", items:[{text:\\\"Hello\\\", fontFamily:\\\"Inter\\\", fontSize:16, textStyleName:\\\"body/medium\\\"}])\\n\\nParams:\\n items (TextItem[], required) — Array of text items to create\\n text (string, optional) — Text content\\n name (string, optional) — Layer name\\n x (number, optional)\\n y (number, optional)\\n width (number, optional) — Fixed width in px — implies layoutSizingHorizontal: FIXED and textAutoResize: HEIGHT\\n parentId (string, optional) — Parent node ID. Omit to place on current page.\\n fontFamily (string, optional) — Font family (default: Inter). Use fonts.list to find installed fonts.\\n fontStyle (string, optional) — Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\\n fontSize (number, optional) — Font size (default: 14)\\n fontWeight (number, optional) — 100-900 (default: 400). Ignored when fontStyle is set.\\n fills (array, optional) — Text color paints — e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills.\\n fontColor (Color, optional) — Shorthand — sets text color (auto-binds to matching variable/style)\\n fontColorVariableName (string, optional) — Bind color variable by name e.g. 'text/primary'\\n fontColorStyleName (string, optional) — Apply paint style — overrides fontColor\\n textStyleId (string, optional) — Text style ID or name (case-insensitive) — overrides fontSize/fontWeight\\n textStyleName (string, optional) — Alias for textStyleId — accepts name (case-insensitive)\\n textAlignHorizontal (LEFT | CENTER | RIGHT | JUSTIFIED, optional)\\n textAlignVertical (TOP | CENTER | BOTTOM, optional)\\n layoutSizingHorizontal (FIXED | HUG | FILL, optional)\\n layoutSizingVertical (FIXED | HUG | FILL, optional)\\n textAutoResize (NONE | WIDTH_AND_HEIGHT | HEIGHT | TRUNCATE, optional) — NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis)\\n componentPropertyName (string, optional) — Bind to a component TEXT property by name. Walks up ancestors to find the nearest component, or targets the component specified by componentId. For deeply nested text, consider using components(method:'create', type:'from_node') with exposeText:true instead — it auto-discovers and binds all text nodes.\\n componentId (string, optional) — Target component ID for componentPropertyName binding. When omitted, walks up ancestors to find the nearest COMPONENT or COMPONENT_SET.\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"set_content\": \"# text.set_content\\nReplace text content on existing text nodes\\n\\nParams:\\n items (array, required) — Array of {nodeId, text}\\n nodeId (string, required) — Text node ID\\n text (string, required) — New text content\\n depth (number, optional) — Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\",\n \"scan\": \"# text.scan\\nScan all text nodes within a subtree\\n\\nParams:\\n items ({ nodeId: string; limit?: number; includePath?: boolean; includeGeometry?: boolean }[], required) — Array of subtrees to scan\"\n }\n },\n \"variable_collections\": {\n \"summary\": \"# variable_collections\\nCRUD for variable collections — the document-level API for design tokens.\\n\\nMethods:\\n list List variable collections [read]\\n get Get collection with all variables and values (full document) [read]\\n create Create a collection with modes and variables in one call [create]\\n update Rename collections [edit]\\n delete Delete collections [edit]\\n add_mode Add a mode to a collection [create]\\n rename_mode Rename a mode [edit]\\n remove_mode Remove a mode from a collection [edit]\\n\\n// Variable collections group design tokens and define their modes (e.g. Light/Dark, Desktop/Mobile).\\n// All ID params accept both IDs and display names.\\n// ---\\n// valuesByMode: values keyed by mode name, e.g. {\\\"Light\\\": \\\"#FFF\\\", \\\"Dark\\\": \\\"#111\\\"}.\\n// Aliases: {type: \\\"VARIABLE_ALIAS\\\", name: \\\"other/variable\\\"}.\\n// scopes: see variables endpoint for full list.\\n// Deleting a collection deletes all variables inside it.\\n// The default mode cannot be removed. Use add_mode/remove_mode for additional modes.\\n\\nUse variable_collections(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"list\": \"# variable_collections.list\\nList variable collections\\n\\nParams:\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"get\": \"# variable_collections.get\\nGet collection with all variables and values (full document)\\n\\nParams:\\n id (string, required) — Collection ID or name\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\",\n \"create\": \"# variable_collections.create\\nCreate a collection with modes and variables in one call\\n\\nExample: variable_collections(method:\\\"create\\\", items:[{name:\\\"Tokens\\\", modes:[\\\"Light\\\",\\\"Dark\\\"], variables:[{name:\\\"bg/primary\\\", type:\\\"COLOR\\\", valuesByMode:{\\\"Light\\\":\\\"#FFF\\\",\\\"Dark\\\":\\\"#111\\\"}, scopes:[\\\"ALL_FILLS\\\"]}, {name:\\\"text/primary\\\", type:\\\"COLOR\\\", valuesByMode:{\\\"Light\\\":\\\"#111\\\",\\\"Dark\\\":\\\"#F0F0F0\\\"}, scopes:[\\\"TEXT_FILL\\\"]}, {name:\\\"space/16\\\", type:\\\"FLOAT\\\", value:16, scopes:[\\\"GAP\\\",\\\"WIDTH_HEIGHT\\\"]}, {name:\\\"radius/8\\\", type:\\\"FLOAT\\\", value:8, scopes:[\\\"CORNER_RADIUS\\\"]}]}])\\n\\nParams:\\n items (array, required) — Array of collection documents\\n name (string, required) — Collection name\\n modes (string[], optional) — Mode names (e.g. ['Light', 'Dark']). Omit for single-mode collection.\\n variables (array, optional) — Variables to create inside this collection\\n name (string, required) — Variable name (unique within collection)\\n type (COLOR | FLOAT | STRING | BOOLEAN, required) — Variable type\\n value (variable_value, optional) — Shorthand — sets the default mode value. Use valuesByMode for multi-mode.\\n valuesByMode (object, optional) — Values keyed by mode name (e.g. {\\\"Light\\\": \\\"#FFF\\\", \\\"Dark\\\": \\\"#111\\\"})\\n description (string, optional)\\n scopes (string[], optional) — Restrict where variable can be applied (default: ALL_SCOPES)\",\n \"update\": \"# variable_collections.update\\nRename collections\\n\\nParams:\\n items (array, required) — Array of {id, name}\\n id (string, required) — Collection ID or name\\n name (string, required) — New name\",\n \"delete\": \"# variable_collections.delete\\nDelete collections\\n\\nParams:\\n id (string, optional) — Collection ID or name\\n items (array, optional) — Batch: [{id}, ...]\\n id (string, required)\",\n \"add_mode\": \"# variable_collections.add_mode\\nAdd a mode to a collection\\n\\nParams:\\n items (array, required) — Array of {collectionId, name}\\n collectionId (string, required) — Collection ID or name\\n name (string, required) — Mode name\",\n \"rename_mode\": \"# variable_collections.rename_mode\\nRename a mode\\n\\nParams:\\n items (array, required) — Array of {collectionId, modeId, name}\\n collectionId (string, required) — Collection ID or name\\n modeId (string, required) — Mode ID or name (e.g. \\\"Dark\\\")\\n name (string, required) — New name\",\n \"remove_mode\": \"# variable_collections.remove_mode\\nRemove a mode from a collection\\n\\nParams:\\n items (array, required) — Array of {collectionId, modeId}\\n collectionId (string, required) — Collection ID or name\\n modeId (string, required) — Mode ID or name (e.g. \\\"Dark\\\")\"\n }\n },\n \"variables\": {\n \"summary\": \"# variables\\nSearch and update design variables within a collection.\\n\\nMethods:\\n list Search variables within a collection [read]\\n get Get variable detail by name [read]\\n create Create variables in a collection. Use valuesByMode for multi-mode, or value for default mode only. [create]\\n update Update variable metadata and/or set values [edit]\\n delete Delete variables [edit]\\n\\n// Search and update variables within a collection. collectionId is required on all methods.\\n// Use variable_collections to create full token sets (collection + modes + variables in one call).\\n// ---\\n// query: prefix match first, then substring. \\\"bg/\\\" matches bg/canvas, bg/surface, etc.\\n// valuesByMode: values keyed by mode name. value is shorthand for the default mode.\\n// Aliases: {type: \\\"VARIABLE_ALIAS\\\", name: \\\"other/variable\\\"}.\\n// scopes: ALL_SCOPES, TEXT_CONTENT, WIDTH_HEIGHT, GAP, CORNER_RADIUS, ALL_FILLS, FRAME_FILL, SHAPE_FILL,\\n// TEXT_FILL, STROKE_COLOR, STROKE_FLOAT, EFFECT_FLOAT, EFFECT_COLOR, OPACITY, FONT_FAMILY, FONT_STYLE,\\n// FONT_WEIGHT, FONT_SIZE, LINE_HEIGHT, LETTER_SPACING, PARAGRAPH_SPACING, PARAGRAPH_INDENT\\n\\nUse variables(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"list\": \"# variables.list\\nSearch variables within a collection\\n\\nExample: variables(method:\\\"list\\\", collectionId:\\\"Colors\\\", query:\\\"bg/\\\")\\n\\nParams:\\n collectionId (string, required) — Collection ID or name\\n query (string, optional) — Search query — prefix match first, then substring fallback\\n type (COLOR | FLOAT | STRING | BOOLEAN, optional) — Filter by variable type\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\\n offset (number, optional) — Skip N items for pagination (default 0)\\n limit (number, optional) — Max items per page (default 100)\",\n \"get\": \"# variables.get\\nGet variable detail by name\\n\\nParams:\\n name (string, required) — Variable name (unique within collection)\\n collectionId (string, required) — Collection ID or name\\n fields (string[], optional) — Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\",\n \"create\": \"# variables.create\\nCreate variables in a collection. Use valuesByMode for multi-mode, or value for default mode only.\\n\\nExample: variables(method:\\\"create\\\", collectionId:\\\"Colors\\\", items:[{name:\\\"bg/primary\\\", type:\\\"COLOR\\\", valuesByMode:{\\\"Light\\\":\\\"#FFF\\\",\\\"Dark\\\":\\\"#111\\\"}, scopes:[\\\"ALL_FILLS\\\"]}])\\n\\nParams:\\n collectionId (string, required) — Collection ID or name\\n items (VariableCreateItem[], required) — Array of variables to create\\n name (string, required) — Variable name (must be unique within collection)\\n type (COLOR | FLOAT | STRING | BOOLEAN, required) — Variable type\\n value (variable_value, optional) — Shorthand — sets the default mode value. Use valuesByMode for multi-mode.\\n valuesByMode (object, optional) — Values keyed by mode name (e.g. {\\\"Light\\\": \\\"#FFF\\\", \\\"Dark\\\": \\\"#111\\\"}). Takes precedence over value.\\n description (string, optional) — Variable description\\n scopes (string[], optional) — Restrict where variable can be applied (default: ALL_SCOPES)\",\n \"update\": \"# variables.update\\nUpdate variable metadata and/or set values\\n\\nExample: variables(method:\\\"update\\\", collectionId:\\\"Colors\\\", items:[{name:\\\"bg/primary\\\", valuesByMode:{\\\"Light\\\":\\\"#FFF\\\",\\\"Dark\\\":\\\"#222\\\"}}])\\n\\nParams:\\n collectionId (string, required) — Collection ID or name\\n items (VariableUpdateItem[], required) — Array of variable updates\\n name (string, required) — Variable name\\n rename (string, optional) — Rename the variable\\n description (string, optional) — Set description\\n scopes (string[], optional) — Update scopes\\n value (variable_value, optional) — Shorthand — sets the default mode value. Use valuesByMode for multi-mode.\\n valuesByMode (object, optional) — Values keyed by mode name. Takes precedence over value.\",\n \"delete\": \"# variables.delete\\nDelete variables\\n\\nParams:\\n collectionId (string, required) — Collection ID or name\\n name (string, optional) — Variable name\\n items (array, optional) — Batch: [{name}, ...]\\n name (string, required)\"\n }\n },\n \"version_history\": {\n \"summary\": \"# version_history\\nSave named versions to the Figma file's version history.\\n\\nMethods:\\n save Save a named version to the file's version history [edit]\\n\\n// Version history lets you create named snapshots of a Figma file.\\n// Use this after completing design tasks to create an audit trail of changes.\\n// Equivalent to Figma's File → Save to Version History (Cmd+Opt+S).\\n\\nUse version_history(method: \\\"help\\\", topic: \\\"<method>\\\") for method details.\",\n \"methods\": {\n \"save\": \"# version_history.save\\nSave a named version to the file's version history\\n\\nParams:\\n title (string, required) — Version title (e.g., \\\"Added hero sections with website copy\\\")\\n description (string, optional) — Optional longer description of what changed\"\n }\n }\n};\n\nexport const helpTopics: Record<string, string> = {\n \"missing_tools\": \"# Missing Create / Edit Tools\\n\\nIf the user asks you to create or modify something in Figma but you cannot find create/edit methods on endpoint tools, the MCP server was started without the correct access tier flag.\\n\\nVibma filters available methods at startup based on CLI flags passed in the MCP config `args` array:\\n\\n| Flag | Methods available |\\n|------|-----------------|\\n| _(none)_ | Read-only (get, list, check, scan, export) |\\n| `--create` | Read + creation methods (create, clone) |\\n| `--edit` | All methods (read + create + update + delete) |\\n\\nAsk the user to add `--edit` (or `--create`) to their MCP config args:\\n\\n```json\\n{\\n \\\"mcpServers\\\": {\\n \\\"Vibma\\\": {\\n \\\"command\\\": \\\"npx\\\",\\n \\\"args\\\": [\\\"-y\\\", \\\"@ufira/vibma\\\", \\\"--edit\\\"]\\n }\\n }\\n}\\n```\\n\\nAfter updating, the user must restart their AI tool or reload MCP servers — stdio-based servers cannot hot-reload.\"\n};\n\nconst allEndpointNames = Object.keys(helpEndpoints);\nconst allTopicNames = Object.keys(helpTopics);\n\n/** Resolve a help query. Returns help text. Always includes available options on error. */\nexport function resolveHelp(topic?: string): string {\n if (!topic) return helpDirectory;\n const dot = topic.indexOf(\".\");\n if (dot === -1) {\n const ep = helpEndpoints[topic];\n if (ep) return ep.summary;\n const t = helpTopics[topic];\n if (t) return t;\n const all = [...allEndpointNames, ...allTopicNames];\n return \"Unknown topic: \" + topic + \". Available: \" + all.join(\", \");\n }\n const epName = topic.slice(0, dot);\n const methodName = topic.slice(dot + 1);\n const ep = helpEndpoints[epName];\n if (!ep) {\n const all = [...allEndpointNames, ...allTopicNames];\n return \"Unknown topic: \" + epName + \". Available: \" + all.join(\", \");\n }\n const method = ep.methods[methodName];\n if (method) return method;\n return \"Unknown method: \" + methodName + \" on \" + epName + \". Available methods: \" + Object.keys(ep.methods).join(\", \");\n}\n\n/** Resolve a per-endpoint help query (for method=\"help\" on an endpoint). */\nexport function resolveEndpointHelp(endpoint: string, topic?: string): string | null {\n const ep = helpEndpoints[endpoint];\n if (!ep) return null;\n if (!topic) return ep.summary;\n const method = ep.methods[topic];\n if (method) return method;\n return \"Unknown method: \" + topic + \". Available methods on \" + endpoint + \": \" + Object.keys(ep.methods).join(\", \");\n}\n","// AUTO-GENERATED by schema compiler — do not edit\nimport { z } from \"zod\";\nimport { flexJson, flexBool } from \"../../utils/coercion\";\nimport * as S from \"../schemas\";\nimport type { ToolDef, Capabilities } from \"../types\";\n\n/** Filter method enum values by capability tier */\nfunction filterMethodsByTier(\n schema: Record<string, z.ZodTypeAny>,\n caps: Capabilities,\n methodTiers: Record<string, string>,\n): Record<string, z.ZodTypeAny> {\n const methods = Object.keys(methodTiers).filter(m => {\n const tier = methodTiers[m];\n if (tier === \"read\") return true;\n if (tier === \"create\") return caps.create;\n if (tier === \"edit\") return caps.edit;\n return false;\n });\n return { ...schema, method: z.enum(methods as [string, ...string[]]) };\n}\n\n/**\n * Command dispatch map: endpoint → method → Figma command name.\n * For discriminated methods (create with type), the value is a sub-map: type → command.\n */\nexport const commandMap: Record<string, Record<string, string>> = {\n \"components\": {\"clone\":\"components.clone\",\"audit\":\"components.audit\",\"reparent\":\"components.reparent\",\"list\":\"components.list\",\"get\":\"components.get\",\"create\":\"components.create\",\"update\":\"components.update\",\"delete\":\"components.delete\"},\n \"connection\": {\"create\":\"connection.create\",\"get\":\"connection.get\",\"list\":\"connection.list\",\"delete\":\"connection.delete\"},\n \"document\": {\"get\":\"document.get\",\"list\":\"document.list\",\"set\":\"document.set\",\"create\":\"document.create\",\"update\":\"document.update\"},\n \"fonts\": {\"list\":\"fonts.list\"},\n \"frames\": {\"get\":\"frames.get\",\"list\":\"frames.list\",\"update\":\"frames.update\",\"delete\":\"frames.delete\",\"clone\":\"frames.clone\",\"audit\":\"frames.audit\",\"reparent\":\"frames.reparent\",\"create\":\"frames.create\",\"export\":\"frames.export\"},\n \"instances\": {\"list\":\"instances.list\",\"delete\":\"instances.delete\",\"clone\":\"instances.clone\",\"audit\":\"instances.audit\",\"reparent\":\"instances.reparent\",\"get\":\"instances.get\",\"create\":\"instances.create\",\"update\":\"instances.update\",\"swap\":\"instances.swap\",\"detach\":\"instances.detach\",\"reset_overrides\":\"instances.reset_overrides\"},\n \"lint\": {\"check\":\"lint.check\",\"fix\":\"lint.fix\"},\n \"prototyping\": {\"get\":\"prototyping.get\",\"add\":\"prototyping.add\",\"set\":\"prototyping.set\",\"remove\":\"prototyping.remove\"},\n \"selection\": {\"get\":\"selection.get\",\"set\":\"selection.set\"},\n \"styles\": {\"list\":\"styles.list\",\"get\":\"styles.get\",\"create\":\"styles.create\",\"update\":\"styles.update\",\"delete\":\"styles.delete\"},\n \"text\": {\"get\":\"text.get\",\"list\":\"text.list\",\"update\":\"text.update\",\"delete\":\"text.delete\",\"clone\":\"text.clone\",\"audit\":\"text.audit\",\"reparent\":\"text.reparent\",\"create\":\"text.create\",\"set_content\":\"text.set_content\",\"scan\":\"text.scan\"},\n \"variable_collections\": {\"list\":\"variable_collections.list\",\"get\":\"variable_collections.get\",\"create\":\"variable_collections.create\",\"update\":\"variable_collections.update\",\"delete\":\"variable_collections.delete\",\"add_mode\":\"variable_collections.add_mode\",\"rename_mode\":\"variable_collections.rename_mode\",\"remove_mode\":\"variable_collections.remove_mode\"},\n \"variables\": {\"list\":\"variables.list\",\"get\":\"variables.get\",\"create\":\"variables.create\",\"update\":\"variables.update\",\"delete\":\"variables.delete\"},\n \"version_history\": {\"save\":\"version_history.save\"},\n};\n\n/** Methods handled inline (local WS state, not sent to Figma) */\nexport const inlineMethods: Record<string, Record<string, boolean>> = {\n \"connection\": {\"create\":true,\"list\":true,\"delete\":true},\n};\n\nexport const tools: ToolDef[] = [\n {\n name: \"components\",\n description: \"/** Create and manage reusable components and variant sets. Use method \\\"help\\\" for detailed parameter docs. */\\n clone (id, parentId?, x?, y?, depth?) → { results: {id}[] } // Duplicate nodes\\n audit (id, rules?, maxDepth?, maxFindings?) → { nodeId?, nodeName?, categories? } // Run lint on a node — returns severity-ranked findings\\n reparent (items: { id: string; parentId: string; index?: number }[]) → { results: \\\"ok\\\"[] } // Move nodes into a new parent\\n list (query?, offset?, limit?) → { totalCount, items } // List local component names (variant sets as single entries)\\n get (id?, names?) → { results } // Get component detail — property definitions + ID for instances.create\\n create (type: component|from_node|variant_set, items: (ComponentItem | FromNodeItem | VariantSetItem)[]) → { results: {id}[] } // Create components\\n update (items: UpdatePropertyItem[], depth?) → { results: (\\\"ok\\\" | {error})[] } // Add, edit, or delete component properties\\n delete (id) → { results: \\\"ok\\\"[] } // Delete components or component sets\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"clone\", \"audit\", \"reparent\", \"list\", \"get\", \"create\", \"update\", \"delete\", \"help\"]),\n id: z.string().optional().describe(\"Node ID\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n depth: z.coerce.number().optional().describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\"),\n rules: flexJson(z.array(z.string())).optional().describe(\"Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\"),\n maxDepth: z.coerce.number().optional().describe(\"Max tree depth (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Max findings (default: 50)\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to reparent/update\"),\n query: z.string().optional().describe(\"Name search query (case-insensitive substring match)\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n names: flexJson(z.array(z.string())).optional().describe(\"Batch lookup by name (case-insensitive). Either id or names is required.\"),\n type: z.enum([\"component\", \"from_node\", \"variant_set\"]).optional().describe(\"Discriminant for create method\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"clone\":\"create\",\"audit\":\"read\",\"reparent\":\"edit\",\"list\":\"read\",\"get\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"delete\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"delete\") {\n if (params.id === undefined) throw new Error(\"delete requires \\\"id\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n if (params.items) {\n if (params.type === \"variant_set\") for (const it of params.items) { if (it.nodeIds !== undefined && it.componentIds === undefined) { it.componentIds = it.nodeIds; delete it.nodeIds; } }\n }\n const schemas: Record<string, z.ZodTypeAny> = {\n \"component\": z.object({\n name: z.string().describe(\"Component name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n rotation: z.coerce.number().optional().describe(\"Rotation in degrees (0-360)\"),\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: flexBool(z.boolean()).optional().describe(\"Show/hide (default true)\"),\n locked: flexBool(z.boolean()).optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeStyleName: z.string().optional().describe(\"Paint style name for stroke\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\"),\n strokeTopWeight: S.token.optional(),\n strokeBottomWeight: S.token.optional(),\n strokeLeftWeight: S.token.optional(),\n strokeRightWeight: S.token.optional(),\n strokeAlign: z.enum([\"INSIDE\", \"OUTSIDE\", \"CENTER\"]).optional().describe(\"Stroke position (default: INSIDE)\"),\n strokesIncludedInLayout: flexBool(z.boolean()).optional().describe(\"Include stroke width in layout measurements (default: false)\"),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n padding: S.token.optional().describe(\"All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\"),\n paddingTop: S.token.optional(),\n paddingRight: S.token.optional(),\n paddingBottom: S.token.optional(),\n paddingLeft: S.token.optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: S.token.optional().describe(\"Spacing between children (number or variable name string, default: 0)\"),\n counterAxisSpacing: S.token.optional().describe(\"Gap between wrapped rows (requires layoutWrap: WRAP)\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n overflowDirection: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\", \"BOTH\"]).optional().describe(\"Scroll overflow in prototype (default: NONE)\"),\n description: z.string().optional().describe(\"Component description (shown in Figma's component panel)\"),\n children: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Inline child nodes. Text: {type:\\\"text\\\", text, componentPropertyName?, fontFamily?, fontSize?, fontColor?}. Frame: {type:\\\"frame\\\", name?, layoutMode?, fillColor?, children?}. Text with componentPropertyName auto-creates and binds a TEXT property — no need to add it to properties separately.\"),\n properties: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Component properties to define at creation: [{propertyName, type, defaultValue}]. TEXT properties for inline children with componentPropertyName are created automatically.\"),\n }).passthrough(),\n \"from_node\": z.object({\n nodeId: z.string().describe(\"Node ID to convert\"),\n exposeText: flexBool(z.boolean()).optional().describe(\"Auto-expose text as editable properties (default: true)\"),\n }).passthrough(),\n \"variant_set\": z.object({\n name: z.string().optional().describe(\"Node name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n rotation: z.coerce.number().optional().describe(\"Rotation in degrees (0-360)\"),\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: flexBool(z.boolean()).optional().describe(\"Show/hide (default true)\"),\n locked: flexBool(z.boolean()).optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeStyleName: z.string().optional().describe(\"Paint style name for stroke\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\"),\n strokeTopWeight: S.token.optional(),\n strokeBottomWeight: S.token.optional(),\n strokeLeftWeight: S.token.optional(),\n strokeRightWeight: S.token.optional(),\n strokeAlign: z.enum([\"INSIDE\", \"OUTSIDE\", \"CENTER\"]).optional().describe(\"Stroke position (default: INSIDE)\"),\n strokesIncludedInLayout: flexBool(z.boolean()).optional().describe(\"Include stroke width in layout measurements (default: false)\"),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n padding: S.token.optional().describe(\"All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\"),\n paddingTop: S.token.optional(),\n paddingRight: S.token.optional(),\n paddingBottom: S.token.optional(),\n paddingLeft: S.token.optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: S.token.optional().describe(\"Spacing between children (number or variable name string, default: 0)\"),\n counterAxisSpacing: S.token.optional().describe(\"Gap between wrapped rows (requires layoutWrap: WRAP)\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n overflowDirection: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\", \"BOTH\"]).optional().describe(\"Scroll overflow in prototype (default: NONE)\"),\n componentIds: flexJson(z.array(z.string())).describe(\"Component IDs to combine (min 2)\"),\n variantPropertyName: z.string().optional().describe(\"Rename the auto-generated variant property (default: 'Property 1')\"),\n }).passthrough(),\n };\n const s = params.type && schemas[params.type];\n if (s) {\n try { params.items = z.array(s).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = s instanceof z.ZodObject ? (s as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n }\n if (m === \"update\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Component or component set ID\"),\n propertyName: z.string().describe(\"Property name with #suffix for edit/delete (e.g. \\\"Label#1:0\\\"). Call components.get to find exact keys. For add, plain name works.\"),\n action: z.enum([\"add\", \"edit\", \"delete\", \"rename_variant\"]).optional().describe(\"\\\"add\\\" (default): requires type + defaultValue. \\\"edit\\\": pass defaultValue to change default, name to rename property. \\\"delete\\\": just propertyName. \\\"rename_variant\\\": pass defaultValue=current option name, name=new option name.\"),\n type: z.enum([\"BOOLEAN\", \"TEXT\", \"INSTANCE_SWAP\", \"VARIANT\"]).optional().describe(\"Property type (required for add)\"),\n defaultValue: S.stringOrBoolean.optional().describe(\"Default value (add/edit). For rename_variant: the CURRENT option name to rename\"),\n name: z.string().optional().describe(\"New name — for edit: renames the property itself, for rename_variant: the new option value name\"),\n preferredValues: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Preferred values for INSTANCE_SWAP\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"clone\":\"components.clone\",\"audit\":\"components.audit\",\"reparent\":\"components.reparent\",\"list\":\"components.list\",\"get\":\"components.get\",\"create\":\"components.create\",\"update\":\"components.update\",\"delete\":\"components.delete\"},\n },\n {\n name: \"connection\",\n description: \"/** Manage the Figma plugin connection. Use method \\\"help\\\" for detailed parameter docs. */\\n create (channel?) → string // Join a relay channel (required first step before any other tool)\\n get () → { status, documentName, currentPage, timestamp } // Verify end-to-end connection to Figma\\n list () → unknown // Inspect which clients (MCP, plugin) are connected to each channel\\n delete (channel?) → string // Disconnect all clients (MCP server and Figma plugin) from a channel and reset its state\\n// Connection manages the WebSocket link between the MCP server and the Figma plugin.\\n// Channels are named rooms — both the MCP server and Figma plugin must join the same channel to communicate.\\n// Workflow: connection(method:\\\"create\\\") to join a channel → connection(method:\\\"get\\\") to verify Figma plugin is connected.\\n// If get times out (5s), the Figma plugin is not running or not on the same channel.\\n// list shows all active channels and their connected clients. delete factory-resets a channel.\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"create\", \"get\", \"list\", \"delete\", \"help\"]),\n channel: z.string().optional().default(\"vibma\").describe(\"The channel name displayed in the Figma plugin panel. Defaults to 'vibma' if omitted.\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"create\":\"read\",\"get\":\"read\",\"list\":\"read\",\"delete\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n timeout: 5000,\n commandMap: {\"create\":\"connection.create\",\"get\":\"connection.get\",\"list\":\"connection.list\",\"delete\":\"connection.delete\"},\n },\n {\n name: \"document\",\n description: \"/** Navigate and manage Figma pages (canvases) in the document. Use method \\\"help\\\" for detailed parameter docs. */\\n get () → { id, name, backgroundColor?, children: NodeStub[] } // Get current page with top-level children\\n list () → { name, currentPageId, pages } // Get document name and list all pages\\n set (pageId?, pageName?) → { id, name } // Switch to a page by ID or name. At least one of pageId or pageName must be provided.\\n create (name?) → { id } // Create a new page\\n update (newName, pageId?) → string // Rename a page\\n// A Figma document contains pages — each page is an independent canvas with its own node tree.\\n// The \\\"current page\\\" is where all node operations happen. Use document.set to switch pages before working with nodes.\\n// Page IDs look like \\\"0:1\\\", \\\"1:1\\\", etc. The first page is always \\\"0:1\\\".\\n// get returns the current page with its top-level children as stubs. list returns all pages in the document.\\n// Shared types:\\n// NodeStub: {id: string, name: string, type: string}\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"get\", \"list\", \"set\", \"create\", \"update\", \"help\"]),\n pageId: z.string().optional().describe(\"Page ID\"),\n pageName: z.string().optional().describe(\"Page name (case-insensitive, substring match)\"),\n name: z.string().optional().describe(\"Page name (default: 'New Page')\"),\n newName: z.string().optional().describe(\"New page name\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"get\":\"read\",\"list\":\"read\",\"set\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"update\") {\n if (params.newName === undefined) throw new Error(\"update requires \\\"newName\\\"\");\n }\n },\n commandMap: {\"get\":\"document.get\",\"list\":\"document.list\",\"set\":\"document.set\",\"create\":\"document.create\",\"update\":\"document.update\"},\n },\n {\n name: \"fonts\",\n description: \"/** Search available fonts in Figma. Use method \\\"help\\\" for detailed parameter docs. */\\n list (query?, includeStyles?, offset?, limit?) → { count, fonts } // List available font families, optionally filtered by name\\n// Returns font family names installed in the Figma environment. Use to verify a fontFamily before text.create or styles.create.\\n// query filters by family name substring (case-insensitive), e.g. query:\\\"inter\\\" matches \\\"Inter\\\", \\\"Inter Tight\\\".\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"list\", \"help\"]),\n query: z.string().optional().describe(\"Filter by family name (case-insensitive substring)\"),\n includeStyles: flexBool(z.boolean()).optional().describe(\"Include available styles per family (default: false)\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"list\":\"read\",\"help\":\"read\"}),\n tier: \"read\" as const,\n commandMap: {\"list\":\"fonts.list\"},\n },\n {\n name: \"frames\",\n description: \"/** Create and manage frames, shapes, auto-layout containers, sections, and SVG nodes. Use method \\\"help\\\" for detailed parameter docs. */\\n get (id, fields?, depth?, verbose?) → { results: Node[], _truncated?, _notice? } // Get serialized node data\\n list (query?, types?, parentId?, fields?, offset?, limit?) → { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only — use get with depth for full properties)\\n update (items: PatchItem[]) → { results: (\\\"ok\\\" | {error})[] } // Patch node properties\\n delete (id?, items?: { id?: string }[]) → { results: \\\"ok\\\"[] } // Delete nodes\\n clone (id, parentId?, x?, y?, depth?) → { results: {id}[] } // Duplicate nodes\\n audit (id, rules?, maxDepth?, maxFindings?) → { nodeId?, nodeName?, categories? } // Run lint on a node — returns severity-ranked findings\\n reparent (items: { id: string; parentId: string; index?: number }[]) → { results: \\\"ok\\\"[] } // Move nodes into a new parent\\n create (type: frame|auto_layout|section|rectangle|ellipse|line|group|boolean_operation|svg, items: (FrameItem | AutoLayoutItem | SectionItem | RectangleItem | EllipseItem | LineItem | GroupItem | BooleanOperationItem | SvgItem)[]) → { results: {id}[] } // Create frame-like containers\\n export (id, format?: PNG|JPG|SVG|SVG_STRING|PDF, scale?) → { imageData?, mimeType? } // Export a node as PNG, JPG, SVG, SVG_STRING, or PDF\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"get\", \"list\", \"update\", \"delete\", \"clone\", \"audit\", \"reparent\", \"create\", \"export\", \"help\"]),\n id: z.string().optional().describe(\"Node ID\"),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n depth: z.coerce.number().optional().describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\"),\n verbose: z.boolean().optional().describe(\"Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\"),\n query: z.string().optional().describe(\"Name search query (case-insensitive substring match)\"),\n types: flexJson(z.array(z.string())).optional().describe(\"Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\"),\n parentId: z.string().optional().describe(\"Search only within this subtree\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to update/delete/reparent\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n rules: flexJson(z.array(z.string())).optional().describe(\"Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\"),\n maxDepth: z.coerce.number().optional().describe(\"Max tree depth (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Max findings (default: 50)\"),\n type: z.enum([\"frame\", \"auto_layout\", \"section\", \"rectangle\", \"ellipse\", \"line\", \"group\", \"boolean_operation\", \"svg\"]).optional().describe(\"Discriminant for create method\"),\n format: z.enum([\"PNG\", \"JPG\", \"SVG\", \"SVG_STRING\", \"PDF\"]).optional().describe(\"Export format (default: PNG). SVG_STRING returns raw SVG text.\"),\n scale: z.coerce.number().optional().describe(\"Export scale (default: 1, only for PNG/JPG)\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"get\":\"read\",\"list\":\"read\",\"update\":\"edit\",\"delete\":\"edit\",\"clone\":\"create\",\"audit\":\"read\",\"reparent\":\"edit\",\"create\":\"create\",\"export\":\"read\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"export\") {\n if (params.id === undefined) throw new Error(\"export requires \\\"id\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n const schemas: Record<string, z.ZodTypeAny> = {\n \"frame\": z.object({\n name: z.string().optional().describe(\"Node name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n rotation: z.coerce.number().optional().describe(\"Rotation in degrees (0-360)\"),\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: flexBool(z.boolean()).optional().describe(\"Show/hide (default true)\"),\n locked: flexBool(z.boolean()).optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeStyleName: z.string().optional().describe(\"Paint style name for stroke\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\"),\n strokeTopWeight: S.token.optional(),\n strokeBottomWeight: S.token.optional(),\n strokeLeftWeight: S.token.optional(),\n strokeRightWeight: S.token.optional(),\n strokeAlign: z.enum([\"INSIDE\", \"OUTSIDE\", \"CENTER\"]).optional().describe(\"Stroke position (default: INSIDE)\"),\n strokesIncludedInLayout: flexBool(z.boolean()).optional().describe(\"Include stroke width in layout measurements (default: false)\"),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n padding: S.token.optional().describe(\"All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\"),\n paddingTop: S.token.optional(),\n paddingRight: S.token.optional(),\n paddingBottom: S.token.optional(),\n paddingLeft: S.token.optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: S.token.optional().describe(\"Spacing between children (number or variable name string, default: 0)\"),\n counterAxisSpacing: S.token.optional().describe(\"Gap between wrapped rows (requires layoutWrap: WRAP)\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n overflowDirection: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\", \"BOTH\"]).optional().describe(\"Scroll overflow in prototype (default: NONE)\"),\n clipsContent: flexBool(z.boolean()).optional(),\n }).passthrough(),\n \"auto_layout\": z.object({\n name: z.string().optional().describe(\"Node name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 100)\"),\n rotation: z.coerce.number().optional().describe(\"Rotation in degrees (0-360)\"),\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: flexBool(z.boolean()).optional().describe(\"Show/hide (default true)\"),\n locked: flexBool(z.boolean()).optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeStyleName: z.string().optional().describe(\"Paint style name for stroke\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\"),\n strokeTopWeight: S.token.optional(),\n strokeBottomWeight: S.token.optional(),\n strokeLeftWeight: S.token.optional(),\n strokeRightWeight: S.token.optional(),\n strokeAlign: z.enum([\"INSIDE\", \"OUTSIDE\", \"CENTER\"]).optional().describe(\"Stroke position (default: INSIDE)\"),\n strokesIncludedInLayout: flexBool(z.boolean()).optional().describe(\"Include stroke width in layout measurements (default: false)\"),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutMode: z.enum([\"HORIZONTAL\", \"VERTICAL\"]).describe(\"Primary axis direction\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n padding: S.token.optional().describe(\"All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\"),\n paddingTop: S.token.optional(),\n paddingRight: S.token.optional(),\n paddingBottom: S.token.optional(),\n paddingLeft: S.token.optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n itemSpacing: S.token.optional().describe(\"Spacing between children (number or variable name string, default: 0)\"),\n counterAxisSpacing: S.token.optional().describe(\"Gap between wrapped rows (requires layoutWrap: WRAP)\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n overflowDirection: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\", \"BOTH\"]).optional().describe(\"Scroll overflow in prototype (default: NONE)\"),\n clipsContent: flexBool(z.boolean()).optional(),\n nodeIds: flexJson(z.array(z.string())).optional().describe(\"Existing node IDs to wrap into auto-layout\"),\n }).passthrough(),\n \"section\": z.object({\n name: z.string().describe(\"Section name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width (default: 500)\"),\n height: z.coerce.number().optional().describe(\"Height (default: 500)\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n }).passthrough(),\n \"rectangle\": z.object({\n name: z.string().optional().describe(\"Layer name (default: 'Rectangle')\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width in px (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height in px (default: 100)\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional(),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n opacity: S.token.optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"FILL\"]).optional().describe(\"Horizontal sizing in auto-layout parent\"),\n layoutSizingVertical: z.enum([\"FIXED\", \"FILL\"]).optional().describe(\"Vertical sizing in auto-layout parent\"),\n }).passthrough(),\n \"ellipse\": z.object({\n name: z.string().optional().describe(\"Layer name (default: 'Ellipse')\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n width: z.coerce.number().optional().describe(\"Width in px (default: 100)\"),\n height: z.coerce.number().optional().describe(\"Height in px (default: 100, same as width for circle)\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional(),\n opacity: S.token.optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"FILL\"]).optional().describe(\"Horizontal sizing in auto-layout parent\"),\n layoutSizingVertical: z.enum([\"FIXED\", \"FILL\"]).optional().describe(\"Vertical sizing in auto-layout parent\"),\n }).passthrough(),\n \"line\": z.object({\n name: z.string().optional().describe(\"Layer name (default: 'Line')\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n length: z.coerce.number().optional().describe(\"Line length in px (default: 100)\"),\n rotation: z.coerce.number().optional().describe(\"Rotation in degrees (default: 0 = horizontal)\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear\"),\n strokeColor: S.colorRgba.optional().describe(\"Line color (default: black, auto-binds to matching variable/style)\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"Line thickness (default: 1)\"),\n opacity: S.token.optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"FILL\"]).optional().describe(\"Horizontal sizing in auto-layout parent (defaults to FILL in vertical auto-layout)\"),\n }).passthrough(),\n \"group\": z.object({\n nodeIds: z.array(z.string()).describe(\"Node IDs to group (min 1)\"),\n name: z.string().optional().describe(\"Group name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n }).passthrough(),\n \"boolean_operation\": z.object({\n operation: z.enum([\"UNION\", \"SUBTRACT\", \"INTERSECT\", \"EXCLUDE\"]).describe(\"Boolean operation type\"),\n nodeIds: z.array(z.string()).describe(\"Node IDs to combine (min 2, first node is the base for SUBTRACT)\"),\n name: z.string().optional().describe(\"Result node name\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n }).passthrough(),\n \"svg\": z.object({\n svg: z.string().describe(\"SVG markup string\"),\n name: z.string().optional().describe(\"Layer name (default: 'SVG')\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n fillStyleName: z.string().optional().describe(\"Paint style to apply to vector fills\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name for vector fills\"),\n strokeStyleName: z.string().optional().describe(\"Paint style to apply to vector strokes\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for vector strokes\"),\n }).passthrough(),\n };\n const s = params.type && schemas[params.type];\n if (s) {\n try { params.items = z.array(s).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = s instanceof z.ZodObject ? (s as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n }\n },\n commandMap: {\"get\":\"frames.get\",\"list\":\"frames.list\",\"update\":\"frames.update\",\"delete\":\"frames.delete\",\"clone\":\"frames.clone\",\"audit\":\"frames.audit\",\"reparent\":\"frames.reparent\",\"create\":\"frames.create\",\"export\":\"frames.export\"},\n },\n {\n name: \"instances\",\n description: \"/** Create and manage component instances. Use method \\\"help\\\" for detailed parameter docs. */\\n list (query?, types?, parentId?, fields?, offset?, limit?) → { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only — use get with depth for full properties)\\n delete (id?, items?: { id?: string }[]) → { results: \\\"ok\\\"[] } // Delete nodes\\n clone (id, parentId?, x?, y?, depth?) → { results: {id}[] } // Duplicate nodes\\n audit (id, rules?, maxDepth?, maxFindings?) → { nodeId?, nodeName?, categories? } // Run lint on a node — returns severity-ranked findings\\n reparent (items: { id: string; parentId: string; index?: number }[]) → { results: \\\"ok\\\"[] } // Move nodes into a new parent\\n get (id, fields?, depth?, verbose?) → { results, _truncated? } // Get instance detail with component properties and overrides\\n create (items: InstanceCreateItem[], depth?) → { results: {id}[] } // Create component instances\\n update (items: InstanceUpdateItem[]) → { results: (\\\"ok\\\" | {error})[] } // Set instance properties\\n swap (items: { id: string; componentId: string }[]) → { results: (\\\"ok\\\" | {error})[] } // Swap instance component (preserves overrides)\\n detach (items: { id: string }[]) → { results: {id}[] } // Detach instances from their component (converts to frame)\\n reset_overrides(items: { id: string }[]) → { results: (\\\"ok\\\" | {error})[] } // Reset all overrides on instances to match their main component\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"list\", \"delete\", \"clone\", \"audit\", \"reparent\", \"get\", \"create\", \"update\", \"swap\", \"detach\", \"reset_overrides\", \"help\"]),\n query: z.string().optional().describe(\"Name search query (case-insensitive substring match)\"),\n types: flexJson(z.array(z.string())).optional().describe(\"Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\"),\n parentId: z.string().optional().describe(\"Search only within this subtree\"),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n id: z.string().optional().describe(\"Single node ID\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to delete/reparent/create/update/swap/detach/reset_overrides\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n depth: z.coerce.number().optional().describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\"),\n rules: flexJson(z.array(z.string())).optional().describe(\"Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\"),\n maxDepth: z.coerce.number().optional().describe(\"Max tree depth (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Max findings (default: 50)\"),\n verbose: z.boolean().optional().describe(\"Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"list\":\"read\",\"delete\":\"edit\",\"clone\":\"create\",\"audit\":\"read\",\"reparent\":\"edit\",\"get\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"swap\":\"edit\",\"detach\":\"edit\",\"reset_overrides\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"get\") {\n if (params.id === undefined) throw new Error(\"get requires \\\"id\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n for (const it of params.items) {\n if (it.id !== undefined && it.componentId === undefined) { it.componentId = it.id; delete it.id; }\n }\n const itemSchema = z.object({\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: flexBool(z.boolean()).optional().describe(\"Show/hide (default true)\"),\n locked: flexBool(z.boolean()).optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n componentId: z.string().describe(\"Component or component set ID\"),\n variantProperties: z.record(z.string(), z.unknown()).optional().describe(\"Pick variant e.g. {\\\"Style\\\":\\\"Secondary\\\"}\"),\n properties: z.record(z.string(), z.unknown()).optional().describe(\"Set component properties inline e.g. {\\\"Label\\\":\\\"Click me\\\", \\\"ShowIcon\\\":true}. Same as instances.update properties.\"),\n name: z.string().optional().describe(\"Instance layer name\"),\n x: z.coerce.number().optional(),\n y: z.coerce.number().optional(),\n width: z.coerce.number().optional().describe(\"Override width (resize)\"),\n height: z.coerce.number().optional().describe(\"Override height (resize)\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"update\") {\n const itemSchema = z.object({\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Fill paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] for transparent. Primary way to set fills.\"),\n fillColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid fill (auto-binds to matching variable/style)\"),\n fillStyleName: z.string().optional().describe(\"Paint style name for fill\"),\n fillVariableName: z.string().optional().describe(\"Color variable by name e.g. 'bg/primary'\"),\n strokes: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Stroke paints array — e.g. [{type: 'SOLID', color: '#hex'}] or [] to clear. Primary way to set strokes.\"),\n strokeColor: S.colorRgba.optional().describe(\"Shorthand — sets a single solid stroke (auto-binds to matching variable/style)\"),\n strokeStyleName: z.string().optional().describe(\"Paint style name for stroke\"),\n strokeVariableName: z.string().optional().describe(\"Color variable by name for stroke\"),\n strokeWeight: S.token.optional().describe(\"All sides (number) or variable name (string). Per-side: strokeTopWeight, strokeBottomWeight, strokeLeftWeight, strokeRightWeight.\"),\n strokeTopWeight: S.token.optional(),\n strokeBottomWeight: S.token.optional(),\n strokeLeftWeight: S.token.optional(),\n strokeRightWeight: S.token.optional(),\n strokeAlign: z.enum([\"INSIDE\", \"OUTSIDE\", \"CENTER\"]).optional().describe(\"Stroke position (default: INSIDE)\"),\n strokesIncludedInLayout: flexBool(z.boolean()).optional().describe(\"Include stroke width in layout measurements (default: false)\"),\n cornerRadius: S.token.optional().describe(\"All corners (number) or variable name (string). Per-corner: topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius.\"),\n topLeftRadius: S.token.optional(),\n topRightRadius: S.token.optional(),\n bottomRightRadius: S.token.optional(),\n bottomLeftRadius: S.token.optional(),\n opacity: S.token.optional().describe(\"Opacity (0-1) or variable name\"),\n visible: z.boolean().optional().describe(\"Show/hide (default true)\"),\n locked: z.boolean().optional().describe(\"Lock/unlock (default false)\"),\n blendMode: z.enum([\"PASS_THROUGH\", \"NORMAL\", \"DARKEN\", \"MULTIPLY\", \"LINEAR_BURN\", \"COLOR_BURN\", \"LIGHTEN\", \"SCREEN\", \"LINEAR_DODGE\", \"COLOR_DODGE\", \"OVERLAY\", \"SOFT_LIGHT\", \"HARD_LIGHT\", \"DIFFERENCE\", \"EXCLUSION\", \"HUE\", \"SATURATION\", \"COLOR\", \"LUMINOSITY\"]).optional(),\n effectStyleName: z.string().optional().describe(\"Effect style name (e.g. 'Shadow/Card') for shadows, blurs\"),\n layoutMode: z.enum([\"NONE\", \"HORIZONTAL\", \"VERTICAL\"]).optional().describe(\"Layout direction (default: NONE)\"),\n layoutWrap: z.enum([\"NO_WRAP\", \"WRAP\"]).optional(),\n padding: S.token.optional().describe(\"All edges (number) or variable name (string). Per-edge: paddingTop, paddingRight, paddingBottom, paddingLeft.\"),\n paddingTop: S.token.optional(),\n paddingRight: S.token.optional(),\n paddingBottom: S.token.optional(),\n paddingLeft: S.token.optional(),\n primaryAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"SPACE_BETWEEN\"]).optional(),\n counterAxisAlignItems: z.enum([\"MIN\", \"MAX\", \"CENTER\", \"BASELINE\"]).optional(),\n itemSpacing: S.token.optional().describe(\"Spacing between children (number or variable name string, default: 0)\"),\n counterAxisSpacing: S.token.optional().describe(\"Gap between wrapped rows (requires layoutWrap: WRAP)\"),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutPositioning: z.enum([\"AUTO\", \"ABSOLUTE\"]).optional().describe(\"ABSOLUTE = floating inside auto-layout parent\"),\n minWidth: z.coerce.number().optional().describe(\"Min width for responsive auto-layout\"),\n maxWidth: z.coerce.number().optional().describe(\"Max width for responsive auto-layout\"),\n minHeight: z.coerce.number().optional().describe(\"Min height for responsive auto-layout\"),\n maxHeight: z.coerce.number().optional().describe(\"Max height for responsive auto-layout\"),\n fontSize: z.number().optional().describe(\"Font size\"),\n fontFamily: z.string().optional().describe(\"Font family\"),\n fontStyle: z.string().optional().describe(\"Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\"),\n fontWeight: z.number().optional().describe(\"100-900. Ignored when fontStyle is set.\"),\n fontColor: S.colorRgba.optional().describe(\"Shorthand — sets text color (auto-binds to matching variable/style)\"),\n fontColorVariableName: z.string().optional().describe(\"Bind color variable by name e.g. 'text/primary'\"),\n fontColorStyleName: z.string().optional().describe(\"Apply paint style — overrides fontColor\"),\n textStyleId: z.string().optional().describe(\"Apply text style by ID — overrides fontSize/fontWeight\"),\n textStyleName: z.string().optional().describe(\"Text style by name (case-insensitive)\"),\n textAlignHorizontal: z.enum([\"LEFT\", \"CENTER\", \"RIGHT\", \"JUSTIFIED\"]).optional(),\n textAlignVertical: z.enum([\"TOP\", \"CENTER\", \"BOTTOM\"]).optional(),\n textAutoResize: z.enum([\"NONE\", \"WIDTH_AND_HEIGHT\", \"HEIGHT\", \"TRUNCATE\"]).optional(),\n id: z.string().describe(\"Instance node ID\"),\n properties: z.record(z.string(), z.unknown()).optional().describe(\"Component property key→value map\"),\n componentProperties: z.record(z.string(), z.unknown()).optional().describe(\"Alias for properties (matches instances.get response shape)\"),\n name: z.string().optional().describe(\"Rename node\"),\n rotation: z.number().optional().describe(\"Degrees (0-360)\"),\n x: z.number().optional(),\n y: z.number().optional(),\n width: z.number().optional(),\n height: z.number().optional(),\n clearFill: z.boolean().optional().describe(\"Remove all fills\"),\n effects: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Effect array (DROP_SHADOW, INNER_SHADOW, LAYER_BLUR, BACKGROUND_BLUR)\"),\n constraints: z.object({\n horizontal: z.enum([\"MIN\", \"CENTER\", \"MAX\", \"STRETCH\", \"SCALE\"]),\n vertical: z.enum([\"MIN\", \"CENTER\", \"MAX\", \"STRETCH\", \"SCALE\"]),\n }).optional(),\n bindings: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Bind variables to properties. field path examples: 'fills/0/color', 'strokes/0/color', 'opacity', 'width', 'cornerRadius', 'itemSpacing'.\"),\n explicitMode: z.record(z.string(), z.unknown()).optional().describe(\"Pin variable mode — use { collectionName, modeName } (preferred) or { collectionId, modeId }\"),\n exportSettings: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Export settings\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"swap\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Instance node ID\"),\n componentId: z.string().describe(\"New component or component set ID\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"detach\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Instance node ID\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"reset_overrides\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Instance node ID\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"list\":\"instances.list\",\"delete\":\"instances.delete\",\"clone\":\"instances.clone\",\"audit\":\"instances.audit\",\"reparent\":\"instances.reparent\",\"get\":\"instances.get\",\"create\":\"instances.create\",\"update\":\"instances.update\",\"swap\":\"instances.swap\",\"detach\":\"instances.detach\",\"reset_overrides\":\"instances.reset_overrides\"},\n },\n {\n name: \"lint\",\n description: \"/** Run design quality and accessibility checks. Use method \\\"help\\\" for detailed parameter docs. */\\n check (nodeId?, rules?, maxDepth?, maxFindings?) → { nodeId, nodeName, categories, warning? } // Run design linter on a node tree\\n fix (items: { nodeId: string; layoutMode?: \\\"VERTICAL\\\" | \\\"HORIZONTAL\\\"; itemSpacing?: number }[], depth?) → { results: (\\\"ok\\\" | {error})[] } // Auto-fix frames to auto-layout\\n// Lint runs automated design quality and accessibility checks on a node tree.\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"check\", \"fix\", \"help\"]),\n nodeId: z.string().optional().describe(\"Node ID to lint. If omitted: 1 selected node → lints that node, 2+ selected → lints entire page (not the selection), 0 selected → error. Always pass nodeId explicitly for reliable targeting.\"),\n rules: flexJson(z.array(z.string())).optional().describe(\"Rules to run. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\"/\\\"accessibility\\\". Or specific rule names.\"),\n maxDepth: z.coerce.number().optional().describe(\"Max tree depth (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Max findings (default: 50)\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {nodeId, layoutMode?, itemSpacing?}\"),\n depth: z.coerce.number().optional().describe(\"Response detail for fixed nodes: omit for stubs, 0=properties, -1=full tree\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"check\":\"read\",\"fix\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (!params.items) return;\n if (m === \"fix\") {\n for (const it of params.items) {\n if (it.id !== undefined && it.nodeId === undefined) { it.nodeId = it.id; delete it.id; }\n }\n const itemSchema = z.object({\n nodeId: z.string().describe(\"Frame node ID\"),\n layoutMode: z.enum([\"VERTICAL\", \"HORIZONTAL\"]).optional().describe(\"Direction (default: auto-detected)\"),\n itemSpacing: z.coerce.number().optional().describe(\"Spacing between children\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"check\":\"lint.check\",\"fix\":\"lint.fix\"},\n },\n {\n name: \"prototyping\",\n description: \"/** Manage prototype interactions, reactions, and navigation flows. Use method \\\"help\\\" for detailed parameter docs. */\\n get (id) → { reactions?, overflowDirection? } // Get reactions and overflow direction on a node\\n add (id, trigger: ON_CLICK|ON_HOVER|ON_PRESS|ON_DRAG|AFTER_TIMEOUT|MOUSE_ENTER|MOUSE_LEAVE|ON_KEY_DOWN, triggerDelay?, triggerKeyCodes?, triggerDevice?: KEYBOARD|XBOX_ONE|PS4|SWITCH_PRO, destination?, navigation?: NAVIGATE|SWAP|OVERLAY|SCROLL_TO|CHANGE_TO, transition?: DISSOLVE|SMART_ANIMATE|MOVE_IN|MOVE_OUT|PUSH|SLIDE_IN|SLIDE_OUT|INSTANT, transitionDirection?: LEFT|RIGHT|TOP|BOTTOM, duration?, easing?: EASE_IN|EASE_OUT|EASE_IN_AND_OUT|LINEAR|GENTLE|QUICK|BOUNCY|SLOW, actionType?: NODE|BACK|CLOSE|URL|SET_VARIABLE_MODE, url?, collectionName?, modeName?, resetScrollPosition?, actions?) → { results: \\\"ok\\\"[] } // Add a prototype reaction to a node\\n set (id, reactions) → { results: \\\"ok\\\"[] } // Replace all reactions on a node (raw reactions array)\\n remove (id, index) → { results: \\\"ok\\\"[] } // Remove a reaction from a node by index\\n// Reactions wire up interactions: trigger (ON_CLICK, ON_HOVER, ...) → action (navigate, swap, overlay).\\n// Common patterns: button ON_CLICK → NAVIGATE to detail frame; card ON_HOVER → CHANGE_TO hover variant.\\n// Multi-action: pass actions[] array to run multiple actions on one trigger (e.g. navigate + set variable mode).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"get\", \"add\", \"set\", \"remove\", \"help\"]),\n id: z.string().optional().describe(\"Node ID\"),\n trigger: z.enum([\"ON_CLICK\", \"ON_HOVER\", \"ON_PRESS\", \"ON_DRAG\", \"AFTER_TIMEOUT\", \"MOUSE_ENTER\", \"MOUSE_LEAVE\", \"ON_KEY_DOWN\"]).optional().describe(\"Trigger type\"),\n triggerDelay: z.coerce.number().optional().describe(\"Delay in ms for AFTER_TIMEOUT / MOUSE_ENTER / MOUSE_LEAVE triggers\"),\n triggerKeyCodes: z.unknown().optional().describe(\"Key codes for ON_KEY_DOWN trigger\"),\n triggerDevice: z.enum([\"KEYBOARD\", \"XBOX_ONE\", \"PS4\", \"SWITCH_PRO\"]).optional().describe(\"Device for ON_KEY_DOWN (default: KEYBOARD)\"),\n destination: z.string().optional().describe(\"Target node ID (required for NODE actions)\"),\n navigation: z.enum([\"NAVIGATE\", \"SWAP\", \"OVERLAY\", \"SCROLL_TO\", \"CHANGE_TO\"]).optional().describe(\"Navigation type (default: NAVIGATE)\"),\n transition: z.enum([\"DISSOLVE\", \"SMART_ANIMATE\", \"MOVE_IN\", \"MOVE_OUT\", \"PUSH\", \"SLIDE_IN\", \"SLIDE_OUT\", \"INSTANT\"]).optional().describe(\"Transition animation (default: DISSOLVE). INSTANT = no animation.\"),\n transitionDirection: z.enum([\"LEFT\", \"RIGHT\", \"TOP\", \"BOTTOM\"]).optional().describe(\"Direction for MOVE_IN, MOVE_OUT, PUSH, SLIDE_IN, SLIDE_OUT\"),\n duration: z.coerce.number().optional().describe(\"Transition duration in seconds (default: 0.3)\"),\n easing: z.enum([\"EASE_IN\", \"EASE_OUT\", \"EASE_IN_AND_OUT\", \"LINEAR\", \"GENTLE\", \"QUICK\", \"BOUNCY\", \"SLOW\"]).optional().describe(\"Easing function (default: EASE_OUT)\"),\n actionType: z.enum([\"NODE\", \"BACK\", \"CLOSE\", \"URL\", \"SET_VARIABLE_MODE\"]).optional().describe(\"Action type (default: NODE). SET_VARIABLE_MODE switches a variable collection mode.\"),\n url: z.string().optional().describe(\"URL for URL action type\"),\n collectionName: z.string().optional().describe(\"Variable collection name (for SET_VARIABLE_MODE)\"),\n modeName: z.string().optional().describe(\"Mode name to switch to (for SET_VARIABLE_MODE)\"),\n resetScrollPosition: flexBool(z.boolean()).optional().describe(\"Reset scroll position on navigate (default: true)\"),\n actions: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Multi-action: [{actionType, destination?, navigation?, collectionName?, modeName?, ...}]. Overrides single-action params.\"),\n reactions: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Full reactions array — [{trigger:{type}, actions:[{type, destinationId, navigation, transition}]}]\"),\n index: z.coerce.number().optional().describe(\"Reaction index (0-based)\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"get\":\"read\",\"add\":\"edit\",\"set\":\"edit\",\"remove\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"get\") {\n if (params.id === undefined) throw new Error(\"get requires \\\"id\\\"\");\n }\n if (m === \"add\") {\n if (params.id === undefined) throw new Error(\"add requires \\\"id\\\"\");\n if (params.trigger === undefined) throw new Error(\"add requires \\\"trigger\\\"\");\n }\n if (m === \"set\") {\n if (params.id === undefined) throw new Error(\"set requires \\\"id\\\"\");\n if (params.reactions === undefined) throw new Error(\"set requires \\\"reactions\\\"\");\n }\n if (m === \"remove\") {\n if (params.id === undefined) throw new Error(\"remove requires \\\"id\\\"\");\n if (params.index === undefined) throw new Error(\"remove requires \\\"index\\\"\");\n }\n },\n commandMap: {\"get\":\"prototyping.get\",\"add\":\"prototyping.add\",\"set\":\"prototyping.set\",\"remove\":\"prototyping.remove\"},\n },\n {\n name: \"selection\",\n description: \"/** Read and set the current Figma selection. Use method \\\"help\\\" for detailed parameter docs. */\\n get (depth?, verbose?) → { results, _truncated?, _notice? } // Get the current selection\\n set (nodeIds) → { count, selectedNodes, notFoundIds? } // Set selection to nodes and scroll viewport to show them\\n// Selection is the set of nodes currently highlighted in the Figma canvas.\\n// get returns the current selection. Without depth, returns stubs ({id, name, type}). With depth=0, returns full properties.\\n// _truncated: true when the response was cut short due to node budget limits. Use depth=0 or specific fields to reduce payload.\\n// set replaces the entire selection AND scrolls the viewport to show the selected nodes.\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"get\", \"set\", \"help\"]),\n depth: z.coerce.number().optional().describe(\"Child recursion depth. Omit for stubs only, 0=selected nodes' properties, -1=unlimited.\"),\n verbose: z.boolean().optional().describe(\"Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\"),\n nodeIds: flexJson(z.array(z.string())).optional().describe(\"Array of node IDs to select. Example: [\\\"1:2\\\",\\\"1:3\\\"]\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"get\":\"read\",\"set\":\"read\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"set\") {\n if (params.nodeIds === undefined) throw new Error(\"set requires \\\"nodeIds\\\"\");\n }\n },\n commandMap: {\"get\":\"selection.get\",\"set\":\"selection.set\"},\n },\n {\n name: \"styles\",\n description: \"/** CRUD for local paint, text, effect, and grid styles. Use method \\\"help\\\" for detailed parameter docs. */\\n list (type?: paint|text|effect|grid, fields?, offset?, limit?) → { totalCount, items } // List local styles with optional type filter\\n get (id, fields?) → { id, name, type, paints?, fontFamily?, fontSize?, effects?, layoutGrids? } // Get full style detail by ID\\n create (type: paint|text|effect|grid, items: (PaintItem | TextItem | EffectItem | GridItem)[]) → { results: {id}[] } // Create local styles\\n update (type?: paint|text|effect|grid, items: PatchStyleItem[]) → { results: (\\\"ok\\\" | {error})[] } // Update styles by ID or name\\n delete (id?, items?: { id: string }[]) → { results: \\\"ok\\\"[] } // Delete styles\\n// Styles are named, reusable design properties that can be applied to nodes. Four types:\\n// paint: a named color (applied to fills/strokes), text: typography settings, effect: shadows/blurs, grid: layout grids.\\n// All ID params accept both IDs and display names (case-insensitive). Use whichever you have.\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"list\", \"get\", \"create\", \"update\", \"delete\", \"help\"]),\n type: z.enum([\"paint\", \"text\", \"effect\", \"grid\"]).optional().describe(\"Filter by style type\"),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n id: z.string().optional().describe(\"Style ID or name\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to create/update/delete\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"list\":\"read\",\"get\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"delete\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"get\") {\n if (params.id === undefined) throw new Error(\"get requires \\\"id\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n const schemas: Record<string, z.ZodTypeAny> = {\n \"paint\": z.object({\n name: z.string().describe(\"Style name\"),\n color: S.colorRgba.describe(\"Color value\"),\n colorVariableName: z.string().optional().describe(\"Bind to a COLOR variable by name (style tracks the variable)\"),\n description: z.string().optional().describe(\"Style description\"),\n }).passthrough(),\n \"text\": z.object({\n name: z.string().describe(\"Style name\"),\n fontFamily: z.string().describe(\"Font family\"),\n fontStyle: z.string().optional().describe(\"Font style (default: Regular)\"),\n fontSize: z.coerce.number().describe(\"Font size\"),\n lineHeight: S.lineHeight.optional(),\n letterSpacing: S.letterSpacing.optional(),\n textCase: z.enum([\"ORIGINAL\", \"UPPER\", \"LOWER\", \"TITLE\", \"SMALL_CAPS\", \"SMALL_CAPS_FORCED\"]).optional(),\n textDecoration: z.enum([\"NONE\", \"UNDERLINE\", \"STRIKETHROUGH\"]).optional(),\n paragraphIndent: z.coerce.number().optional().describe(\"Paragraph indent (px)\"),\n paragraphSpacing: z.coerce.number().optional().describe(\"Paragraph spacing (px)\"),\n leadingTrim: z.enum([\"CAP_HEIGHT\", \"NONE\"]).optional().describe(\"Leading trim mode\"),\n description: z.string().optional().describe(\"Style description\"),\n }).passthrough(),\n \"effect\": z.object({\n name: z.string().describe(\"Style name\"),\n effects: flexJson(z.array(z.record(z.string(), z.unknown()))).describe(\"Array of Effect objects\"),\n description: z.string().optional().describe(\"Style description\"),\n }).passthrough(),\n \"grid\": z.object({\n name: z.string().describe(\"Style name\"),\n layoutGrids: flexJson(z.array(z.record(z.string(), z.unknown()))).describe(\"Array of LayoutGrid objects\"),\n description: z.string().optional().describe(\"Style description\"),\n }).passthrough(),\n };\n const s = params.type && schemas[params.type];\n if (s) {\n try { params.items = z.array(s).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = s instanceof z.ZodObject ? (s as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n }\n if (m === \"update\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Style ID or name\"),\n name: z.string().optional().describe(\"Rename the style\"),\n description: z.string().optional().describe(\"Style description\"),\n color: S.colorRgba.optional().describe(\"New color (paint styles)\"),\n colorVariableName: z.string().optional().describe(\"Bind to a COLOR variable by name (paint styles)\"),\n fontFamily: z.string().optional(),\n fontStyle: z.string().optional(),\n fontSize: z.coerce.number().optional(),\n lineHeight: S.lineHeight.optional(),\n letterSpacing: S.letterSpacing.optional(),\n textCase: z.enum([\"ORIGINAL\", \"UPPER\", \"LOWER\", \"TITLE\", \"SMALL_CAPS\", \"SMALL_CAPS_FORCED\"]).optional(),\n textDecoration: z.enum([\"NONE\", \"UNDERLINE\", \"STRIKETHROUGH\"]).optional(),\n paragraphIndent: z.coerce.number().optional().describe(\"Paragraph indent (px)\"),\n paragraphSpacing: z.coerce.number().optional().describe(\"Paragraph spacing (px)\"),\n leadingTrim: z.enum([\"CAP_HEIGHT\", \"NONE\"]).optional(),\n effects: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of Effect objects\"),\n layoutGrids: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of LayoutGrid objects (grid styles)\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"delete\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Style ID or name\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"list\":\"styles.list\",\"get\":\"styles.get\",\"create\":\"styles.create\",\"update\":\"styles.update\",\"delete\":\"styles.delete\"},\n },\n {\n name: \"text\",\n description: \"/** Create and manage text nodes. Use method \\\"help\\\" for detailed parameter docs. */\\n get (id, fields?, depth?, verbose?) → { results: Node[], _truncated?, _notice? } // Get serialized node data\\n list (query?, types?, parentId?, fields?, offset?, limit?) → { totalCount, returned?, offset?, limit?, results } // Search for nodes (returns stubs only — use get with depth for full properties)\\n update (items: PatchItem[]) → { results: (\\\"ok\\\" | {error})[] } // Patch node properties\\n delete (id?, items?: { id?: string }[]) → { results: \\\"ok\\\"[] } // Delete nodes\\n clone (id, parentId?, x?, y?, depth?) → { results: {id}[] } // Duplicate nodes\\n audit (id, rules?, maxDepth?, maxFindings?) → { nodeId?, nodeName?, categories? } // Run lint on a node — returns severity-ranked findings\\n reparent (items: { id: string; parentId: string; index?: number }[]) → { results: \\\"ok\\\"[] } // Move nodes into a new parent\\n create (items: TextItem[], depth?) → { results: {id}[] } // Create text nodes\\n set_content(items: { nodeId: string; text: string }[], depth?) → { results: \\\"ok\\\"[] } // Replace text content on existing text nodes\\n scan (items: { nodeId: string; limit?: number; includePath?: boolean; includeGeometry?: boolean }[]) → { results: (\\\"ok\\\" | {error})[] } // Scan all text nodes within a subtree\\n// depth: omit → id+name stubs | 0 → props + child stubs | N → recurse N | -1 → full tree\\n// fields: whitelist e.g. [\\\"fills\\\",\\\"opacity\\\"] — id, name, type always included. Pass [\\\"*\\\"] for all.\\n// layoutSizingHorizontal/Vertical: FIXED | HUG | FILL — how the node sizes within auto-layout.\\n// Colors: fillVariableName/strokeVariableName bind by name — preferred over raw color values.\\n// Note: node-based endpoints (frames, text, instances, components) use `results` as the list key.\\n// Standalone endpoints (styles, variables, variable_collections) use `items`. Components.list uses `items` (catalog view).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"get\", \"list\", \"update\", \"delete\", \"clone\", \"audit\", \"reparent\", \"create\", \"set_content\", \"scan\", \"help\"]),\n id: z.string().optional().describe(\"Node ID\"),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n depth: z.coerce.number().optional().describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\"),\n verbose: z.boolean().optional().describe(\"Include all properties (bounding box, constraints, text style details). Default false — returns slim, actionable output.\"),\n query: z.string().optional().describe(\"Name search query (case-insensitive substring match)\"),\n types: flexJson(z.array(z.string())).optional().describe(\"Filter by node types (e.g. [\\\"FRAME\\\", \\\"TEXT\\\"])\"),\n parentId: z.string().optional().describe(\"Search only within this subtree\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to update/delete/reparent/create/set_content/scan\"),\n x: z.coerce.number().optional().describe(\"X position (default: 0)\"),\n y: z.coerce.number().optional().describe(\"Y position (default: 0)\"),\n rules: flexJson(z.array(z.string())).optional().describe(\"Rules to check. Default: [\\\"all\\\"]. Categories: \\\"component\\\", \\\"composition\\\", \\\"token\\\", \\\"naming\\\", \\\"wcag\\\".\"),\n maxDepth: z.coerce.number().optional().describe(\"Max tree depth (default: 10)\"),\n maxFindings: z.coerce.number().optional().describe(\"Max findings (default: 50)\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"get\":\"read\",\"list\":\"read\",\"update\":\"edit\",\"delete\":\"edit\",\"clone\":\"create\",\"audit\":\"read\",\"reparent\":\"edit\",\"create\":\"create\",\"set_content\":\"edit\",\"scan\":\"read\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (!params.items) return;\n if (m === \"create\") {\n for (const it of params.items) {\n if (it.characters !== undefined && it.text === undefined) { it.text = it.characters; delete it.characters; }\n }\n const itemSchema = z.object({\n text: z.string().optional().describe(\"Text content\"),\n name: z.string().optional().describe(\"Layer name\"),\n x: z.number().optional(),\n y: z.number().optional(),\n width: z.number().optional().describe(\"Fixed width in px — implies layoutSizingHorizontal: FIXED and textAutoResize: HEIGHT\"),\n parentId: z.string().optional().describe(\"Parent node ID. Omit to place on current page.\"),\n fontFamily: z.string().optional().describe(\"Font family (default: Inter). Use fonts.list to find installed fonts.\"),\n fontStyle: z.string().optional().describe(\"Font variant e.g. \\\"Bold\\\", \\\"Italic\\\" — overrides fontWeight\"),\n fontSize: z.number().optional().describe(\"Font size (default: 14)\"),\n fontWeight: z.number().optional().describe(\"100-900 (default: 400). Ignored when fontStyle is set.\"),\n fills: z.array(z.record(z.string(), z.unknown())).optional().describe(\"Text color paints — e.g. [{type: 'SOLID', color: '#hex'}]. Same as node fills.\"),\n fontColor: S.colorRgba.optional().describe(\"Shorthand — sets text color (auto-binds to matching variable/style)\"),\n fontColorVariableName: z.string().optional().describe(\"Bind color variable by name e.g. 'text/primary'\"),\n fontColorStyleName: z.string().optional().describe(\"Apply paint style — overrides fontColor\"),\n textStyleId: z.string().optional().describe(\"Text style ID or name (case-insensitive) — overrides fontSize/fontWeight\"),\n textStyleName: z.string().optional().describe(\"Alias for textStyleId — accepts name (case-insensitive)\"),\n textAlignHorizontal: z.enum([\"LEFT\", \"CENTER\", \"RIGHT\", \"JUSTIFIED\"]).optional(),\n textAlignVertical: z.enum([\"TOP\", \"CENTER\", \"BOTTOM\"]).optional(),\n layoutSizingHorizontal: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n layoutSizingVertical: z.enum([\"FIXED\", \"HUG\", \"FILL\"]).optional(),\n textAutoResize: z.enum([\"NONE\", \"WIDTH_AND_HEIGHT\", \"HEIGHT\", \"TRUNCATE\"]).optional().describe(\"NONE (fixed box), WIDTH_AND_HEIGHT (grow both), HEIGHT (fixed width, auto height), TRUNCATE (fixed + ellipsis)\"),\n componentPropertyName: z.string().optional().describe(\"Bind to a component TEXT property by name. Walks up ancestors to find the nearest component, or targets the component specified by componentId. For deeply nested text, consider using components(method:'create', type:'from_node') with exposeText:true instead — it auto-discovers and binds all text nodes.\"),\n componentId: z.string().optional().describe(\"Target component ID for componentPropertyName binding. When omitted, walks up ancestors to find the nearest COMPONENT or COMPONENT_SET.\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"set_content\") {\n for (const it of params.items) {\n if (it.id !== undefined && it.nodeId === undefined) { it.nodeId = it.id; delete it.id; }\n if (it.characters !== undefined && it.text === undefined) { it.text = it.characters; delete it.characters; }\n }\n const itemSchema = z.object({\n nodeId: z.string().describe(\"Text node ID\"),\n text: z.string().describe(\"New text content\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"get\":\"text.get\",\"list\":\"text.list\",\"update\":\"text.update\",\"delete\":\"text.delete\",\"clone\":\"text.clone\",\"audit\":\"text.audit\",\"reparent\":\"text.reparent\",\"create\":\"text.create\",\"set_content\":\"text.set_content\",\"scan\":\"text.scan\"},\n },\n {\n name: \"variable_collections\",\n description: \"/** CRUD for variable collections — the document-level API for design tokens. Use method \\\"help\\\" for detailed parameter docs. */\\n list (fields?, offset?, limit?) → { totalCount, items } // List variable collections\\n get (id, fields?) → { id?, name?, modes?, variables? } // Get collection with all variables and values (full document)\\n create (items: { name: string; modes?: string[]; variables?: { name: string; type: \\\"COLOR\\\" | \\\"FLOAT\\\" | \\\"STRING\\\" | \\\"BOOLEAN\\\"; value?: number | boolean | string | Color | {type: \\\"VARIABLE_ALIAS\\\", name: string}; valuesByMode?: Record<string, unknown>; description?: string; scopes?: string[] }[] }[]) → { results: {id}[] } // Create a collection with modes and variables in one call\\n update (items: { id: string; name: string }[]) → { results: (\\\"ok\\\" | {error})[] } // Rename collections\\n delete (id?, items?: { id: string }[]) → { results: \\\"ok\\\"[] } // Delete collections\\n add_mode (items: { collectionId: string; name: string }[]) → { results: {modeId}[] } // Add a mode to a collection\\n rename_mode(items: { collectionId: string; modeId: string; name: string }[]) → { results: (\\\"ok\\\" | {error})[] } // Rename a mode\\n remove_mode(items: { collectionId: string; modeId: string }[]) → { results: \\\"ok\\\"[] } // Remove a mode from a collection\\n// Variable collections group design tokens and define their modes (e.g. Light/Dark, Desktop/Mobile).\\n// All ID params accept both IDs and display names.\\n// Shared types:\\n// Color: hex \\\"#FF0000\\\" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"list\", \"get\", \"create\", \"update\", \"delete\", \"add_mode\", \"rename_mode\", \"remove_mode\", \"help\"]),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n id: z.string().optional().describe(\"Collection ID or name\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to create/update/delete/add_mode/rename_mode/remove_mode\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"list\":\"read\",\"get\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"delete\":\"edit\",\"add_mode\":\"create\",\"rename_mode\":\"edit\",\"remove_mode\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"get\") {\n if (params.id === undefined) throw new Error(\"get requires \\\"id\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n const itemSchema = z.object({\n name: z.string().describe(\"Collection name\"),\n modes: flexJson(z.array(z.string())).optional().describe(\"Mode names (e.g. ['Light', 'Dark']). Omit for single-mode collection.\"),\n variables: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Variables to create inside this collection\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"update\") {\n const itemSchema = z.object({\n id: z.string().describe(\"Collection ID or name\"),\n name: z.string().describe(\"New name\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"delete\") {\n const itemSchema = z.object({\n id: z.string(),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"add_mode\") {\n const itemSchema = z.object({\n collectionId: z.string().describe(\"Collection ID or name\"),\n name: z.string().describe(\"Mode name\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"rename_mode\") {\n const itemSchema = z.object({\n collectionId: z.string().describe(\"Collection ID or name\"),\n modeId: z.string().describe(\"Mode ID or name (e.g. \\\"Dark\\\")\"),\n name: z.string().describe(\"New name\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"remove_mode\") {\n const itemSchema = z.object({\n collectionId: z.string().describe(\"Collection ID or name\"),\n modeId: z.string().describe(\"Mode ID or name (e.g. \\\"Dark\\\")\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"list\":\"variable_collections.list\",\"get\":\"variable_collections.get\",\"create\":\"variable_collections.create\",\"update\":\"variable_collections.update\",\"delete\":\"variable_collections.delete\",\"add_mode\":\"variable_collections.add_mode\",\"rename_mode\":\"variable_collections.rename_mode\",\"remove_mode\":\"variable_collections.remove_mode\"},\n },\n {\n name: \"variables\",\n description: \"/** Search and update design variables within a collection. Use method \\\"help\\\" for detailed parameter docs. */\\n list (collectionId, query?, type?: COLOR|FLOAT|STRING|BOOLEAN, fields?, offset?, limit?) → { totalCount, items } // Search variables within a collection\\n get (name, collectionId, fields?) → { name, type, collectionId, valuesByMode: Record<string, number | boolean | string | Color | {type: \\\"VARIABLE_ALIAS\\\", name: string}>, description?, scopes? } // Get variable detail by name\\n create (collectionId, items: VariableCreateItem[]) → { results: {name}[] } // Create variables in a collection. Use valuesByMode for multi-mode, or value for default mode only.\\n update (collectionId, items: VariableUpdateItem[]) → { results: (\\\"ok\\\" | {error})[] } // Update variable metadata and/or set values\\n delete (collectionId, name?, items?: { name: string }[]) → { results: \\\"ok\\\"[] } // Delete variables\\n// Search and update variables within a collection. collectionId is required on all methods.\\n// Use variable_collections to create full token sets (collection + modes + variables in one call).\\n// Shared types:\\n// Color: hex \\\"#FF0000\\\" or {r: 0-1, g: 0-1, b: 0-1, a?: 0-1}\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"list\", \"get\", \"create\", \"update\", \"delete\", \"help\"]),\n collectionId: z.string().optional().describe(\"Collection ID or name\"),\n query: z.string().optional().describe(\"Search query — prefix match first, then substring fallback\"),\n type: z.enum([\"COLOR\", \"FLOAT\", \"STRING\", \"BOOLEAN\"]).optional().describe(\"Filter by variable type\"),\n fields: flexJson(z.array(z.string())).optional().describe(\"Property whitelist. Identity fields (id, name, type) always included. Omit for stubs on list, full on get. Pass [\\\"*\\\"] for all.\"),\n offset: z.coerce.number().optional().default(0).describe(\"Skip N items for pagination (default 0)\"),\n limit: z.coerce.number().optional().default(100).describe(\"Max items per page (default 100)\"),\n name: z.string().optional().describe(\"Variable name (unique within collection)\"),\n items: flexJson(z.array(z.record(z.string(), z.unknown()))).optional().describe(\"Array of {id, ...properties} to create/update/delete\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"list\":\"read\",\"get\":\"read\",\"create\":\"create\",\"update\":\"edit\",\"delete\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"list\") {\n if (params.collectionId === undefined) throw new Error(\"list requires \\\"collectionId\\\"\");\n }\n if (m === \"get\") {\n if (params.name === undefined) throw new Error(\"get requires \\\"name\\\"\");\n if (params.collectionId === undefined) throw new Error(\"get requires \\\"collectionId\\\"\");\n }\n if (m === \"create\") {\n if (params.collectionId === undefined) throw new Error(\"create requires \\\"collectionId\\\"\");\n }\n if (m === \"update\") {\n if (params.collectionId === undefined) throw new Error(\"update requires \\\"collectionId\\\"\");\n }\n if (m === \"delete\") {\n if (params.collectionId === undefined) throw new Error(\"delete requires \\\"collectionId\\\"\");\n }\n if (!params.items) return;\n if (m === \"create\") {\n const itemSchema = z.object({\n name: z.string().describe(\"Variable name (must be unique within collection)\"),\n type: z.enum([\"COLOR\", \"FLOAT\", \"STRING\", \"BOOLEAN\"]).describe(\"Variable type\"),\n value: S.variableValue.optional().describe(\"Shorthand — sets the default mode value. Use valuesByMode for multi-mode.\"),\n valuesByMode: z.record(z.string(), z.unknown()).optional().describe(\"Values keyed by mode name (e.g. {\\\"Light\\\": \\\"#FFF\\\", \\\"Dark\\\": \\\"#111\\\"}). Takes precedence over value.\"),\n description: z.string().optional().describe(\"Variable description\"),\n scopes: flexJson(z.array(z.string())).optional().describe(\"Restrict where variable can be applied (default: ALL_SCOPES)\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"update\") {\n const itemSchema = z.object({\n name: z.string().describe(\"Variable name\"),\n rename: z.string().optional().describe(\"Rename the variable\"),\n description: z.string().optional().describe(\"Set description\"),\n scopes: flexJson(z.array(z.string())).optional().describe(\"Update scopes\"),\n value: S.variableValue.optional().describe(\"Shorthand — sets the default mode value. Use valuesByMode for multi-mode.\"),\n valuesByMode: z.record(z.string(), z.unknown()).optional().describe(\"Values keyed by mode name. Takes precedence over value.\"),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n if (m === \"delete\") {\n const itemSchema = z.object({\n name: z.string(),\n }).passthrough();\n try { params.items = z.array(itemSchema).parse(params.items); }\n catch (e) { if (e instanceof z.ZodError) { throw new Error(e.issues.map(i => { const path = i.path.join(\".\"); const shape = itemSchema instanceof z.ZodObject ? (itemSchema as any).shape : null; const desc = shape?.[i.path[1]]?.description; return path + \": \" + i.message + (desc ? \" (expected: \" + desc + \")\" : \"\"); }).join(\"; \")); } throw e; }\n }\n },\n commandMap: {\"list\":\"variables.list\",\"get\":\"variables.get\",\"create\":\"variables.create\",\"update\":\"variables.update\",\"delete\":\"variables.delete\"},\n },\n {\n name: \"version_history\",\n description: \"/** Save named versions to the Figma file's version history. Use method \\\"help\\\" for detailed parameter docs. */\\n save (title, description?) → { id } // Save a named version to the file's version history\\n// Version history lets you create named snapshots of a Figma file.\\n// Use this after completing design tasks to create an audit trail of changes.\\n// Equivalent to Figma's File → Save to Version History (Cmd+Opt+S).\",\n schema: (caps) => filterMethodsByTier({ method: z.enum([\"save\", \"help\"]),\n title: z.string().optional().describe(\"Version title (e.g., \\\"Added hero sections with website copy\\\")\"),\n description: z.string().optional().describe(\"Optional longer description of what changed\"),\n topic: z.string().optional().describe(\"Help topic — method name for endpoint help, e.g. \\\"create\\\"\"),\n }, caps, {\"save\":\"edit\",\"help\":\"read\"}),\n tier: \"read\" as const,\n validate: (params: any) => {\n const m = params.method;\n if (m === \"save\") {\n if (params.title === undefined) throw new Error(\"save requires \\\"title\\\"\");\n }\n },\n commandMap: {\"save\":\"version_history.save\"},\n }\n];\n","import { z } from \"zod\";\n\n// AI agents (Claude, GPT, etc.) frequently pass numbers as strings\n// (\"10\" instead of 10), booleans as strings (\"true\" instead of true),\n// and objects/arrays as JSON strings. These helpers add resilient\n// coercion so tools don't fail on valid-but-mistyped input.\n\n/** Coerce \"true\"/\"false\"/\"1\"/\"0\" strings to boolean */\nexport const flexBool = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (v === \"true\" || v === \"1\") return true;\n if (v === \"false\" || v === \"0\") return false;\n return v;\n }, inner);\n\n/** Coerce JSON strings to parsed values (for objects/arrays that agents may stringify) */\nexport const flexJson = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (typeof v === \"string\") {\n try {\n return JSON.parse(v);\n } catch {\n return v;\n }\n }\n return v;\n }, inner);\n\n/** Coerce numeric strings only when they're valid numbers (safe for use inside unions) */\nexport const flexNum = <T extends z.ZodTypeAny>(inner: T) =>\n z.preprocess((v) => {\n if (typeof v === \"string\") {\n const n = Number(v);\n if (!isNaN(n) && v.trim() !== \"\") return n;\n }\n return v;\n }, inner);\n","import { z } from \"zod\";\nimport { flexJson, flexBool } from \"../utils/coercion\";\n\n// ─── Shared Zod Schema Fragments ────────────────────────────────\n// Import as: import * as S from \"./schemas\";\n\n/** Single node ID */\nexport const nodeId = z.string().describe(\"Node ID\");\n\n/** Array of node IDs */\nexport const nodeIds = flexJson(z.array(z.string())).describe(\"Array of node IDs\");\n\n/** Optional parent reference for creation tools */\nexport const parentId = z.string().optional()\n .describe(\"Parent node ID. Omit to place on current page.\");\n\n/**\n * Response depth — controls how much node detail is returned after an operation.\n * Omit for minimal response (id + name only).\n * 0 = node with full properties, children as stubs.\n * N = recurse N levels of children with full properties.\n * -1 = unlimited recursion.\n */\nexport const depth = z.coerce.number().optional()\n .describe(\"Response detail: omit for id+name only. 0=properties + child stubs. N=recurse N levels. -1=unlimited.\");\n\n/** X position for creation tools */\nexport const xPos = z.coerce.number().optional().describe(\"X position (default: 0)\");\n\n/** Y position for creation tools */\nexport const yPos = z.coerce.number().optional().describe(\"Y position (default: 0)\");\n\n/** Parse hex color string (#RGB, #RRGGBB, #RRGGBBAA) to {r,g,b,a} 0-1 */\nfunction parseHex(hex: string): { r: number; g: number; b: number; a?: number } | null {\n const m = hex.match(/^#?([0-9a-f]{3,8})$/i);\n if (!m) return null;\n let h = m[1];\n if (h.length === 3) h = h[0]+h[0]+h[1]+h[1]+h[2]+h[2];\n if (h.length === 4) h = h[0]+h[0]+h[1]+h[1]+h[2]+h[2]+h[3]+h[3];\n if (h.length !== 6 && h.length !== 8) return null;\n const r = parseInt(h.slice(0, 2), 16) / 255;\n const g = parseInt(h.slice(2, 4), 16) / 255;\n const b = parseInt(h.slice(4, 6), 16) / 255;\n if (h.length === 8) return { r, g, b, a: parseInt(h.slice(6, 8), 16) / 255 };\n return { r, g, b };\n}\n\n/** RGBA color — accepts {r,g,b,a?} object (0-1), hex string (#RGB, #RRGGBB, #RRGGBBAA), or style/variable name string */\nexport const colorRgba = z.preprocess((v) => {\n if (typeof v === \"string\") return parseHex(v) ?? v;\n return v;\n}, z.union([\n z.object({\n r: z.coerce.number().min(0).max(1),\n g: z.coerce.number().min(0).max(1),\n b: z.coerce.number().min(0).max(1),\n a: z.coerce.number().min(0).max(1).optional(),\n }),\n z.string(), // Non-hex strings pass through for handler-level style/variable resolution\n])).describe('Hex \"#FF0000\", {r,g,b,a?} 0-1, or style/variable name.');\n\n/** Variable value — color (hex or RGBA), number, boolean, string, or alias */\nexport const variableValue = z.preprocess((v) => {\n if (typeof v === \"string\") return parseHex(v) ?? v;\n return v;\n}, z.union([\n z.number(),\n z.boolean(),\n z.string(),\n z.object({ r: z.number(), g: z.number(), b: z.number(), a: z.number().optional() }),\n z.object({ type: z.literal(\"VARIABLE_ALIAS\"), name: z.string() }),\n])).describe('number, boolean, string, hex \"#FF0000\", {r,g,b,a?}, or {type:\"VARIABLE_ALIAS\",name:\"other/variable\"}');\n\n/** Line height — number (px) or {value, unit} */\nexport const lineHeight = z.union([\n z.coerce.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\", \"AUTO\"]) }),\n]).describe('number (px) or {value, unit: \"PIXELS\"|\"PERCENT\"|\"AUTO\"}');\n\n/** Letter spacing — number (px) or {value, unit} */\nexport const letterSpacing = z.union([\n z.coerce.number(),\n z.object({ value: z.coerce.number(), unit: z.enum([\"PIXELS\", \"PERCENT\"]) }),\n]).describe('number (px) or {value, unit: \"PIXELS\"|\"PERCENT\"}');\n\n/** String or boolean — for component property defaults */\nexport const stringOrBoolean = z.union([z.string(), z.boolean()]);\n\n/** Design token — accepts a string that is either a numeric value (\"8\") or a variable name/ID (\"Radii/Medium\").\n * Numeric strings are parsed to numbers in the handler; non-numeric strings are variable references. */\nexport const token = z.preprocess((v) => {\n // Accept raw numbers from agents that pass them correctly\n if (typeof v === \"number\") return String(v);\n return v;\n}, z.string()).describe('number as string (\"8\") or variable name (\"Radii/Medium\")');\n\n/** Single effect entry — shared by set_effects and styles create */\nexport const effectEntry = z.object({\n type: z.enum([\"DROP_SHADOW\", \"INNER_SHADOW\", \"LAYER_BLUR\", \"BACKGROUND_BLUR\"]),\n color: flexJson(colorRgba).optional(),\n offset: flexJson(z.object({ x: z.coerce.number(), y: z.coerce.number() })).optional(),\n radius: z.coerce.number(),\n spread: z.coerce.number().optional(),\n visible: flexBool(z.boolean()).optional(),\n blendMode: z.string().optional(),\n});\n","// AUTO-GENERATED by schema compiler — do not edit\n\nexport const guidelinesList: { name: string; title: string }[] = [\n {\n \"name\": \"component-structure\",\n \"title\": \"Component Structure\"\n },\n {\n \"name\": \"library-components\",\n \"title\": \"Working with Library Components\"\n },\n {\n \"name\": \"responsive-designs\",\n \"title\": \"Responsive Sizing\"\n },\n {\n \"name\": \"token-discipline\",\n \"title\": \"Token Discipline\"\n },\n {\n \"name\": \"vibma-workflow\",\n \"title\": \"Vibma Workflow\"\n }\n];\n\nexport const guidelinesContent: Record<string, string> = {\n \"component-structure\": \"# Component Structure\\n\\nComponents need correct sizing, property bindings, and token usage to work well as instances.\\n\\n## Width Constraints\\n\\nComponents with text content need a width — otherwise text never wraps.\\n\\n- Set `width` and `layoutSizingHorizontal:\\\"FIXED\\\"` on cards, panels, list items\\n- HUG on both axes is only correct for buttons, badges, icons — intrinsically-sized elements\\n\\n## Property Bindings\\n\\nEvery text node inside a component should be bound to a TEXT property so instances can edit the content.\\n\\n- On creation: `children:[{type:\\\"text\\\", text:\\\"Title\\\", componentPropertyName:\\\"Title\\\"}]` auto-creates and binds\\n- After creation: `frames(method:\\\"update\\\", items:[{id:\\\"<textNodeId>\\\", componentPropertyName:\\\"<propName>\\\"}])`\\n- For existing nodes with many text children: `components(method:\\\"create\\\", type:\\\"from_node\\\", exposeText:true)`\\n\\nOrphaned properties (defined but not bound to any node) should be deleted:\\n```\\ncomponents(method:\\\"update\\\", items:[{id, propertyName:\\\"<key>\\\", action:\\\"delete\\\"}])\\n```\\n\\n## Variant Sets\\n\\nGroup related components as variants — don't leave them as separate components.\\n\\n- Name variants with the property format: `Style=Primary`, `Style=Secondary`\\n- Combine: `components(method:\\\"create\\\", type:\\\"variant_set\\\", items:[{componentIds:[...], name:\\\"Button\\\"}])`\\n- Instances pick variants via `variantProperties:{\\\"Style\\\":\\\"Primary\\\"}`\\n\\n## Checking\\n\\nRun `components(method:\\\"audit\\\", id)` — checks both lint rules and property bindings in one call.\",\n \"library-components\": \"# Working with Library Components\\n\\nLibrary components are read-only — they come from external team libraries and cannot be edited in the current file.\\n\\n## Reading\\n\\nWhen reading nodes, library instances appear as stubs with their overridable properties:\\n```\\n{name: \\\"Header\\\", type: \\\"INSTANCE\\\", componentProperties: {\\\"Platform\\\": \\\"Desktop\\\"}}\\n```\\n\\nLibrary internals are hidden: no `componentId`, no variable names, no style names. You see resolved values (hex colors, numbers) instead.\\n\\n## Using\\n\\nPlace library instances via `instances(method:\\\"create\\\", items:[{componentId:\\\"<id>\\\"}])` when you have a local component ID. For library components, instances are already placed by the designer — interact via `instances(method:\\\"update\\\")` to set properties.\\n\\n## Customizing\\n\\nTo edit a library component, clone it into the local file first:\\n\\n```\\ncomponents(method:\\\"clone\\\", id:\\\"<instanceId>\\\")\\n```\\n\\nThis resolves the instance to its source component (or full component set) and creates a local copy with a new ID. Edit the local copy freely — it is independent of the library.\\n\\nDo not attempt to `components(method:\\\"get\\\")` or `components(method:\\\"update\\\")` a library component directly — these will error.\\n\\n## Overriding Instance Properties\\n\\nUse `instances(method:\\\"update\\\")` to change overridable properties on library instances:\\n```\\ninstances(method:\\\"update\\\", items:[{id:\\\"<instanceId>\\\", properties:{\\\"Label\\\":\\\"New Text\\\", \\\"State\\\":\\\"Hover\\\"}}])\\n```\\n\\nProperty names are clean (no hash suffixes needed for update — the system resolves partial keys).\",\n \"responsive-designs\": \"# Responsive Sizing\\n\\n## FIXED / FILL / HUG\\n\\n- **FIXED** — layout boundaries: page shell, sidebar width, modal max-width\\n- **FILL** — children that adapt to parent: main content area, nav stacks, cards in columns, text that should wrap\\n- **HUG** — content-sized leaves only: icons, badges, pills, button labels\\n\\n## Component Sizing\\n\\nComponent roots use `FILL` when placed in a parent — they adapt to context, not a fixed specimen width.\\n\\nExample sidebar item:\\n- Instance: `FILL` in parent nav stack\\n- Icon child: fixed 18x18\\n- Label child: `FILL`\\n- Badge child: `HUG`\\n\\n## Text Sizing\\n\\n- Body text inside containers: `FILL` width, `HUG` height (auto-wraps)\\n- Single-line labels: `FILL` horizontal (truncates if needed)\\n- Standalone headings: `HUG` is fine\\n\\nInside auto-layout parents, text defaults to `FILL` horizontal + `HUG` vertical + `textAutoResize: HEIGHT`.\",\n \"token-discipline\": \"# Token Discipline\\n\\nEvery color, spacing value, and text style should come from a design token — not hardcoded values.\\n\\n## Colors\\n\\nBind fills and strokes to color variables instead of hex values.\\n\\n- Fill: `fillVariableName:\\\"bg/primary\\\"` or `fillStyleName:\\\"Surface/Primary\\\"`\\n- Stroke: `strokeVariableName:\\\"border/default\\\"`\\n- Text color: `fontColorVariableName:\\\"text/primary\\\"`\\n\\nIf no matching variable exists, create one first:\\n```\\nvariables(method:\\\"create\\\", collectionId:\\\"Colors\\\", items:[{name:\\\"bg/accent\\\", type:\\\"COLOR\\\", valuesByMode:{\\\"Light\\\":\\\"#E8F0FE\\\",\\\"Dark\\\":\\\"#1A3A5C\\\"}, scopes:[\\\"ALL_FILLS\\\"]}])\\n```\\n\\n## Spacing and Radius\\n\\nPass a variable name string instead of a number for cornerRadius, padding, itemSpacing, strokeWeight, opacity.\\n\\n- `cornerRadius:\\\"radius/8\\\"` not `cornerRadius:8`\\n- `paddingTop:\\\"space/16\\\"` not `paddingTop:16`\\n- `itemSpacing:\\\"space/8\\\"` not `itemSpacing:8`\\n\\nCreate FLOAT variables with appropriate scopes:\\n```\\nvariables(method:\\\"create\\\", collectionId:\\\"Metrics\\\", items:[{name:\\\"space/12\\\", type:\\\"FLOAT\\\", value:12, scopes:[\\\"GAP\\\",\\\"WIDTH_HEIGHT\\\"]}])\\n```\\n\\n## Text Styles\\n\\nApply text styles by name — don't set fontSize/fontFamily/fontWeight manually.\\n\\n- `textStyleName:\\\"Body/M\\\"` on text.create or frames.update\\n- Create styles with `styles(method:\\\"create\\\", type:\\\"text\\\", items:[{name:\\\"Body/M\\\", fontFamily:\\\"Inter\\\", fontSize:14, lineHeight:{value:20, unit:\\\"PIXELS\\\"}}])`\\n\\n## Common Scopes\\n\\nCOLOR variables:\\n- `ALL_FILLS` — background fills\\n- `TEXT_FILL` — text color\\n- `STROKE_COLOR` — borders and outlines\\n\\nFLOAT variables:\\n- `GAP`, `WIDTH_HEIGHT` — spacing and padding\\n- `CORNER_RADIUS` — border radius\\n- `STROKE_FLOAT` — stroke weight\\n- `OPACITY` — transparency\\n\\n## Checking\\n\\nLint rules `hardcoded-color`, `hardcoded-token`, `no-text-style` catch unbound values. Run `audit` on any node to check.\",\n \"vibma-workflow\": \"# Vibma Workflow\\n\\nWork with the tool in a predictable sequence: read before writing, create parents before children, verify after mutations.\\n\\n## Build Order\\n\\n1. `connection.create` → `connection.get` to verify\\n2. Inspect existing structure: `document.get`, `variables.list`, `styles.list`, `components.list`\\n3. Create design tokens: variable collections → variables → text styles → effect styles\\n4. Create components from tokens\\n5. Assemble screens from component instances\\n6. Verify with `lint.check` and `frames.export`\\n\\n## Parent-First Rule\\n\\nCreate parent containers before children. Dependent creates must be sequential — never parallelize when the child needs the parent ID.\\n\\n## Component Creation\\n\\nBuild components early — they are the building blocks for screens. A component IS a frame: create it directly with layout properties, then add children.\\n\\n- Use `components.create(type: \\\"component\\\")` with properties for TEXT, BOOLEAN, INSTANCE_SWAP\\n- TEXT properties auto-bind to child text nodes with matching names\\n- Group related components into variant sets with `components.create(type: \\\"variant_set\\\")` for state dimensions (Style, Size, State)\\n- Use flat components (not variant sets) for INSTANCE_SWAP slots like icons or avatars\\n- Assemble screens from `instances.create`, not by cloning frames\\n\\n## Placement Rule\\n\\nAlways pass `x` and `y` for top-level nodes and clones. Do not stack everything at `0,0`.\\n\\n## Instance Rule\\n\\nCall `components.get` or `instances.get` to discover property keys (including `#suffix`) before setting overrides. Do not guess property names.\\n\\n## Verify After Mutations\\n\\n`\\\"ok\\\"` means the write succeeded, not that the result is correct. Read back the node after clone, swap, mode pinning, or large batch updates.\"\n};\n\n/** Resolve a guidelines query. */\nexport function resolveGuideline(topic?: string): string {\n if (!topic) {\n const dir = [\"# Design Guidelines\", \"\"];\n for (const g of guidelinesList) {\n dir.push(\" \" + g.name.padEnd(30) + g.title);\n }\n dir.push(\"\");\n dir.push('Use guidelines(topic: \"<name>\") for full guideline text.');\n return dir.join(\"\\n\");\n }\n const content = guidelinesContent[topic];\n if (content) return content;\n const names = guidelinesList.map(g => g.name);\n return \"Unknown guideline: \" + topic + \". Available: \" + names.join(\", \");\n}\n","// AUTO-GENERATED by schema compiler — do not edit\nimport type { McpServer } from \"./types\";\n\nexport function registerPrompts(server: McpServer) {\n server.registerPrompt(\n \"design_strategy\",\n { description: \"Best practices for working with Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: \"Figma design best practices:\\n\\n1. Discover First: document(method:\\\"list\\\"), styles(method:\\\"list\\\"), variables(method:\\\"list\\\") — know what exists before creating.\\n\\n2. Design Tokens — Never Hardcode Colors:\\n - Use fillStyleName/strokeStyleName (paint styles) or fillVariableName/strokeVariableName (variables)\\n - Use textStyleName for typography. Only use raw fillColor/fontColor for one-off values.\\n\\n3. Auto-Layout First:\\n - frames(method:\\\"create\\\", type:\\\"auto_layout\\\") for containers, components(method:\\\"create\\\", type:\\\"component\\\") for reusable elements.\\n - A component IS a frame — create it directly with layout/fill/stroke params, then add children. No need to create a frame first and convert.\\n - layoutSizingHorizontal/Vertical: \\\"FILL\\\" for responsive children, \\\"HUG\\\" to shrink-wrap.\\n\\n4. Naming: descriptive names for all elements. Property=Value pattern (e.g. \\\"Size=Small\\\") for variant components.\\n\\n5. Lint After Every Section:\\n - Run lint(method:\\\"check\\\") after building. Always attempt to fix warnings unless you understand the specific warning and it's intentional.\\n - Each warning includes a fix instruction with the exact tool call to use — follow it.\\n - Use lint(method:\\\"fix\\\") to auto-convert frames to auto-layout.\\n - Lint early and often — cheaper to fix during creation than after.\",\n },\n }],\n description: \"Best practices for working with Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"read_design_strategy\",\n { description: \"Best practices for reading Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: \"When reading Figma designs, follow these best practices:\\n\\n1. Start with selection:\\n - First use selection(method: \\\"get\\\") to understand the current selection\\n - If no selection ask user to select single or multiple nodes\",\n },\n }],\n description: \"Best practices for reading Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"text_replacement_strategy\",\n { description: \"Systematic approach for replacing text in Figma designs\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: \"# Intelligent Text Replacement Strategy\\n\\n## 1. Analyze Design & Identify Structure\\n- Scan text nodes to understand the overall structure of the design\\n- Use AI pattern recognition to identify logical groupings:\\n * Tables (rows, columns, headers, cells)\\n * Lists (items, headers, nested lists)\\n * Card groups (similar cards with recurring text fields)\\n * Forms (labels, input fields, validation text)\\n * Navigation (menu items, breadcrumbs)\\n```\\ntext(method: \\\"scan\\\", items: [{nodeId: \\\"node-id\\\"}])\\nframes(method: \\\"get\\\", id: \\\"node-id\\\", depth: 1) // optional\\n```\\n\\n## 2. Strategic Chunking for Complex Designs\\n- Divide replacement tasks into logical content chunks based on design structure\\n- Use one of these chunking strategies that best fits the design:\\n * **Structural Chunking**: Table rows/columns, list sections, card groups\\n * **Spatial Chunking**: Top-to-bottom, left-to-right in screen areas\\n * **Semantic Chunking**: Content related to the same topic or functionality\\n * **Component-Based Chunking**: Process similar component instances together\\n\\n## 3. Progressive Replacement with Verification\\n- Create a safe copy of the node for text replacement\\n- Replace text chunk by chunk with continuous progress updates\\n- After each chunk is processed:\\n * Export that section as a small, manageable image\\n * Verify text fits properly and maintain design integrity\\n * Fix issues before proceeding to the next chunk\\n\\n```\\n// Clone the node to create a safe copy\\nframes(method: \\\"clone\\\", id: \\\"selected-node-id\\\", x: [new-x], y: [new-y])\\n\\n// Replace text chunk by chunk\\ntext(method: \\\"set_content\\\", items: [\\n { nodeId: \\\"node-id-1\\\", text: \\\"New text 1\\\" },\\n // More nodes in this chunk...\\n])\\n\\n// Verify chunk with small, targeted image exports\\nframes(method: \\\"export\\\", nodeId: \\\"chunk-node-id\\\", format: \\\"PNG\\\", scale: 0.5)\\n```\\n\\n## 4. Intelligent Handling for Table Data\\n- For tabular content:\\n * Process one row or column at a time\\n * Maintain alignment and spacing between cells\\n * Consider conditional formatting based on cell content\\n * Preserve header/data relationships\\n\\n## 5. Smart Text Adaptation\\n- Adaptively handle text based on container constraints:\\n * Auto-detect space constraints and adjust text length\\n * Apply line breaks at appropriate linguistic points\\n * Maintain text hierarchy and emphasis\\n * Consider font scaling for critical content that must fit\\n\\n## 6. Progressive Feedback Loop\\n- Establish a continuous feedback loop during replacement:\\n * Real-time progress updates (0-100%)\\n * Small image exports after each chunk for verification\\n * Issues identified early and resolved incrementally\\n * Quick adjustments applied to subsequent chunks\\n\\n## 7. Final Verification & Context-Aware QA\\n- After all chunks are processed:\\n * Export the entire design at reduced scale for final verification\\n * Check for cross-chunk consistency issues\\n * Verify proper text flow between different sections\\n * Ensure design harmony across the full composition\\n\\n## 8. Chunk-Specific Export Scale Guidelines\\n- Scale exports appropriately based on chunk size:\\n * Small chunks (1-5 elements): scale 1.0\\n * Medium chunks (6-20 elements): scale 0.7\\n * Large chunks (21-50 elements): scale 0.5\\n * Very large chunks (50+ elements): scale 0.3\\n * Full design verification: scale 0.2\\n\\n## Sample Chunking Strategy for Common Design Types\\n\\n### Tables\\n- Process by logical rows (5-10 rows per chunk)\\n- Alternative: Process by column for columnar analysis\\n- Tip: Always include header row in first chunk for reference\\n\\n### Card Lists\\n- Group 3-5 similar cards per chunk\\n- Process entire cards to maintain internal consistency\\n- Verify text-to-image ratio within cards after each chunk\\n\\n### Forms\\n- Group related fields (e.g., \\\"Personal Information\\\", \\\"Payment Details\\\")\\n- Process labels and input fields together\\n- Ensure validation messages and hints are updated with their fields\\n\\n### Navigation & Menus\\n- Process hierarchical levels together (main menu, submenu)\\n- Respect information architecture relationships\\n- Verify menu fit and alignment after replacement\\n\\n## Best Practices\\n- **Preserve Design Intent**: Always prioritize design integrity\\n- **Structural Consistency**: Maintain alignment, spacing, and hierarchy\\n- **Visual Feedback**: Verify each chunk visually before proceeding\\n- **Incremental Improvement**: Learn from each chunk to improve subsequent ones\\n- **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight\\n- **Respect Content Relationships**: Keep related content consistent across chunks\\n\\nRemember that text is never just text — it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.\",\n },\n }],\n description: \"Systematic approach for replacing text in Figma designs\",\n })\n );\n\n server.registerPrompt(\n \"swap_overrides_instances\",\n { description: \"Guide to swap instance overrides between instances\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: \"# Swap Component Instance Overrides\\n\\n## Overview\\nTransfer content overrides from a source instance to target instances.\\n\\n## Process\\n\\n### 1. Identify Instances\\n- Use `selection(method: \\\"get\\\")` to identify selected instances\\n- Use `frames(method: \\\"list\\\", types: [\\\"INSTANCE\\\"])` to find instances on the page\\n\\n### 2. Extract Source Overrides\\n- `instances(method: \\\"get\\\", id: \\\"source-instance-id\\\")`\\n- Returns mainComponentId and per-child override fields (characters, fills, fontSize, etc.)\\n\\n### 3. Apply to Targets\\n- For text overrides: use `text(method: \\\"set_content\\\")` on matching child node IDs\\n- For style overrides: use `frames(method: \\\"update\\\")` with fill/stroke/text/effects styleName fields\\n- Match children by name path — source and target instances share the same internal structure\\n\\n### 4. Verify\\n- `frames(method: \\\"get\\\", id: \\\"target-id\\\", depth: 1)` on target instances\\n- `frames(method: \\\"export\\\", nodeId: \\\"target-id\\\")` for visual verification\",\n },\n }],\n description: \"Guide to swap instance overrides between instances\",\n })\n );\n\n server.registerPrompt(\n \"missing_tools\",\n { description: \"Why create or edit tools are missing and how to fix it\" },\n () => ({\n messages: [{\n role: \"assistant\" as const,\n content: {\n type: \"text\" as const,\n text: \"# Missing Create / Edit Tools\\n\\nIf the user asks you to create or modify something in Figma but you cannot find create/edit methods on endpoint tools, the MCP server was started without the correct access tier flag.\\n\\nVibma filters available methods at startup based on CLI flags passed in the MCP config `args` array:\\n\\n| Flag | Methods available |\\n|------|-----------------|\\n| _(none)_ | Read-only (get, list, check, scan, export) |\\n| `--create` | Read + creation methods (create, clone) |\\n| `--edit` | All methods (read + create + update + delete) |\\n\\nAsk the user to add `--edit` (or `--create`) to their MCP config args:\\n\\n```json\\n{\\n \\\"mcpServers\\\": {\\n \\\"Vibma\\\": {\\n \\\"command\\\": \\\"npx\\\",\\n \\\"args\\\": [\\\"-y\\\", \\\"@ufira/vibma\\\", \\\"--edit\\\"]\\n }\\n }\\n}\\n```\\n\\nAfter updating, the user must restart their AI tool or reload MCP servers — stdio-based servers cannot hot-reload.\",\n },\n }],\n description: \"Why create or edit tools are missing and how to fix it\",\n })\n );\n\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iBAA0B;AAC1B,mBAAqC;AAErC,gBAAsB;AACtB,kBAA6B;AAC7B,gBAA6B;AAC7B,kBAA+B;AAC/B,iBAA8B;;;ACT9B,IAAAA,cAAkB;;;ACAlB,iBAAyB;;;AC+CzB,IAAM,qBAAqB;AAGpB,SAAS,QAAQ,MAAe;AACrC,QAAM,OAAO,KAAK,UAAU,IAAI;AAChC,MAAI,KAAK,UAAU,oBAAoB;AACrC,WAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAiB,KAAK,CAAC,EAAE;AAAA,EACtD;AACA,SAAO;AAAA,IACL,SAAS,CAAC;AAAA,MACR,MAAM;AAAA,MACN,MAAM,KAAK,UAAU;AAAA,QACnB,QAAQ;AAAA,QACR,SAAS,KAAK,MAAM,KAAK,SAAS,IAAI;AAAA,QACtC,SAAS;AAAA,MACX,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;AAGO,SAAS,SAAS,QAAgB,OAAgB;AACvD,QAAM,MAAM,iBAAiB,QAAQ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