set_annotation
Add or modify annotations on Figma design elements to document requirements, provide feedback, or track changes within the Cursor AI workflow.
Instructions
Create or update an annotation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to annotate | |
| annotationId | No | The ID of the annotation to update (if updating existing annotation) | |
| labelMarkdown | Yes | The annotation text in markdown format | |
| categoryId | No | The ID of the annotation category | |
| properties | No | Additional properties for the annotation |
Implementation Reference
- src/talk_to_figma_mcp/server.ts:1037-1077 (registration)Registration of the MCP tool 'set_annotation' including Zod input schema validation and handler function that forwards the annotation creation/update parameters to the Figma plugin via sendCommandToFigma WebSocket communication.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)}` } ] }; } } );
- Input schema for the 'set_annotation' tool using Zod for parameter validation: 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") },
- Handler function for 'set_annotation' tool: extracts parameters, calls sendCommandToFigma to execute the annotation operation in the Figma plugin, returns success result or error message in MCP content format.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)}` } ] }; } }