get_annotations
Retrieve annotations from Figma documents to access design notes and comments for specific nodes or entire files.
Instructions
Get all annotations in the current document or specific node
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | No | Optional node ID to get annotations for specific node | |
| includeCategories | No | Whether to include category information |
Implementation Reference
- The handler function for the MCP tool 'get_annotations'. It forwards the request parameters to the Figma plugin using sendCommandToFigma and returns the result as a JSON string in text content, with error handling.// Get Annotations Tool server.tool( "get_annotations", "Get all annotations in the current document or specific node", { nodeId: z.string().optional().describe("Optional node ID to get annotations for specific node"), includeCategories: z.boolean().optional().default(true).describe("Whether to include category information") }, async ({ nodeId, includeCategories }) => { try { const result = await sendCommandToFigma("get_annotations", { nodeId, includeCategories }); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting annotations: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Input schema using Zod for the 'get_annotations' tool parameters.{ nodeId: z.string().optional().describe("Optional node ID to get annotations for specific node"), includeCategories: z.boolean().optional().default(true).describe("Whether to include category information")
- src/talk_to_figma_mcp/server.ts:1001-1001 (registration)Registration of the 'get_annotations' tool with the MCP server using server.tool() method.// Get Annotations Tool
- TypeScript type definition for the parameters of the 'get_annotations' Figma command.get_annotations: { nodeId?: string; includeCategories?: boolean; };