get_annotation
Retrieve feedback and comments attached to a specific Figma design element by providing its node ID.
Instructions
Read annotations from a node in Figma. Uses the proposed Annotations API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to read annotations from |
Implementation Reference
- The handler function that registers and implements the 'get_annotation' tool. It takes a nodeId parameter, calls sendCommandToFigma to retrieve annotations from a Figma node, and returns the node name and annotations as JSON text.
server.tool( "get_annotation", "Read annotations from a node in Figma. Uses the proposed Annotations API.", { nodeId: z.string().describe("The ID of the node to read annotations from"), }, async ({ nodeId }) => { try { const result = await sendCommandToFigma("get_annotation", { nodeId }); const typedResult = result as { name: string; annotations: any[] }; return { content: [ { type: "text", text: JSON.stringify({ name: typedResult.name, annotations: typedResult.annotations }, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting annotations: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); - src/talk_to_figma_mcp/tools/modification-tools.ts:884-913 (registration)The tool is registered via server.tool() with the name 'get_annotation'. Registration and handler are in the same call.
server.tool( "get_annotation", "Read annotations from a node in Figma. Uses the proposed Annotations API.", { nodeId: z.string().describe("The ID of the node to read annotations from"), }, async ({ nodeId }) => { try { const result = await sendCommandToFigma("get_annotation", { nodeId }); const typedResult = result as { name: string; annotations: any[] }; return { content: [ { type: "text", text: JSON.stringify({ name: typedResult.name, annotations: typedResult.annotations }, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error getting annotations: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); - The 'get_annotation' string literal is included in the FigmaCommand union type, serving as a type-level schema for valid commands that can be sent to Figma.
| "set_annotation" | "get_annotation" | "get_variables" | "set_variable" | "apply_variable_to_node" | "switch_variable_mode" | "get_figjam_elements" | "create_sticky" | "set_sticky_text" | "create_shape_with_text" | "create_connector" | "create_section";