delete_node
Remove design elements from Figma by specifying their node ID to manage and clean up your workspace.
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 core handler function for the 'delete_node' MCP tool. It sends a 'delete_node' command to the Figma plugin via websocket with the provided 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)}`, }, ], }; } }
- src/talk_to_figma_mcp/tools/modification-tools.ts:185-213 (registration)Registers the 'delete_node' tool on the MCP server using server.tool(). Includes tool name, description, input schema (nodeId), and references the handler function. This function is called from tools/index.ts.server.tool( "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)}`, }, ], }; } } );
- Zod schema for 'delete_node' tool input validation: requires a single 'nodeId' string parameter.{ nodeId: z.string().describe("The ID of the node to delete"), },