get_local_components
Retrieve all local components from a Figma document to access design elements for programmatic use.
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/server.ts:971-999 (handler)The handler function for the 'get_local_components' MCP tool. It proxies the request to the Figma plugin by calling sendCommandToFigma('get_local_components'), receives the result, and returns it as JSON-formatted text content. Includes error handling.
// Get Local Components Tool 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) }`, }, ], }; } } ); - src/talk_to_figma_mcp/server.ts:971-999 (registration)Registration of the 'get_local_components' tool using McpServer.tool(). Defines the tool name, description, input schema (empty), and handler function.
// Get Local Components Tool 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) }`, }, ], }; } } ); - Input schema for 'get_local_components' tool is empty object ({}), indicating no parameters required.
// Get Local Components Tool