set_annotation
Add or edit annotations on Figma design elements to document specifications, feedback, or implementation details directly within the MCP server.
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 'set_annotation' MCP tool, including description, input schema, and handler function that proxies the call to the Figma plugin.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)}` } ] }; } } );
- The handler function executes the tool logic by sending the annotation parameters to the underlying Figma plugin command 'set_annotation' and returns the result or error.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 schema defining the input parameters for the set_annotation tool.{ 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") },