get_local_components
Retrieve all local components from a Figma document to manage design elements and enable real-time synchronization between code and design workflows.
Instructions
Get all local components from the Figma document
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_local_components"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/tools/document-tools.ts:145-171 (registration)This is the registration of the MCP tool 'get_local_components'. It uses an empty input schema and a handler function that forwards the 'get_local_components' command to the Figma plugin via sendCommandToFigma websocket utility and returns the result as a text content block with JSON stringified data. Error handling is included.
server.tool( "get_local_components", "Get all local components from the Figma document", {}, async () => { try { const result = await sendCommandToFigma("get_local_components"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );