delete_node
Remove a specific element from Figma designs by providing its node ID to clean up and modify layouts.
Instructions
Delete a node from Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to delete |
Implementation Reference
- The async handler function for the 'delete_node' MCP tool. It sends a 'delete_node' command to Figma via sendCommandToFigma with the nodeId and returns a success or error text response.async ({ nodeId }) => { try { await sendCommandToFigma("delete_node", { nodeId }); return { content: [ { type: "text", text: `Deleted node with ID: ${nodeId}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting node: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- Zod input schema for the 'delete_node' tool, requiring a 'nodeId' string.nodeId: z.string().describe("The ID of the node to delete"), }, async ({ nodeId }) => {
- src/talk_to_figma_mcp/tools/modification-tools.ts:186-213 (registration)Registration of the 'delete_node' tool on the MCP server using server.tool(), providing name, description, input schema, and handler."delete_node", "Delete a node from Figma", { nodeId: z.string().describe("The ID of the node to delete"), }, async ({ nodeId }) => { try { await sendCommandToFigma("delete_node", { nodeId }); return { content: [ { type: "text", text: `Deleted node with ID: ${nodeId}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting node: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );