set_annotation
Create or update annotations in Figma designs programmatically, enabling structured and dynamic markups within your design workflow.
Instructions
Create or update an annotation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:1037-1077 (registration)Registration of the MCP tool 'set_annotation', including inline schema definition and handler function that forwards the command to the Figma plugin via WebSocket.server.tool( "set_annotation", "Create or update an annotation", { nodeId: z.string().describe("The ID of the node to annotate"), annotationId: z.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"), labelMarkdown: z.string().describe("The annotation text in markdown format"), categoryId: z.string().optional().describe("The ID of the annotation category"), properties: z.array(z.object({ type: z.string() })).optional().describe("Additional properties for the annotation") }, async ({ nodeId, annotationId, labelMarkdown, categoryId, properties }) => { try { const result = await sendCommandToFigma("set_annotation", { nodeId, annotationId, labelMarkdown, categoryId, properties }); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting annotation: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Handler function for 'set_annotation' tool. It constructs parameters and sends 'set_annotation' command to Figma plugin server via sendCommandToFigma, returns result or error as MCP content.async ({ nodeId, annotationId, labelMarkdown, categoryId, properties }) => { try { const result = await sendCommandToFigma("set_annotation", { nodeId, annotationId, labelMarkdown, categoryId, properties }); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting annotation: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Zod input schema for 'set_annotation' tool parameters: nodeId (required), annotationId (optional), labelMarkdown (required), categoryId (optional), properties (optional array).{ nodeId: z.string().describe("The ID of the node to annotate"), annotationId: z.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"), labelMarkdown: z.string().describe("The annotation text in markdown format"), categoryId: z.string().optional().describe("The ID of the annotation category"), properties: z.array(z.object({ type: z.string() })).optional().describe("Additional properties for the annotation") },
- TypeScript type definition for set_annotation command parameters used in sendCommandToFigma.set_annotation: { nodeId: string; annotationId?: string; labelMarkdown: string; categoryId?: string; properties?: Array<{ type: string }>; };