delete_node
Remove a specific node from Figma designs by specifying its ID, enabling programmatic design updates through natural language commands via the Talk to Figma MCP server.
Instructions
Delete a node from Figma
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"nodeId": {
"description": "The ID of the node to delete",
"type": "string"
}
},
"required": [
"nodeId"
],
"type": "object"
}
Implementation Reference
- src/talk_to_figma_mcp/server.ts:790-820 (registration)MCP tool registration for 'delete_node'. Includes input schema (nodeId: string), description, and handler function that proxies the delete_node command to the Figma plugin via WebSocket.// Delete Node Tool server.tool( "delete_node", "Delete a node from Figma", { nodeId: z.string().describe("The ID of the node to delete"), }, async ({ nodeId }: any) => { 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/server.ts:797-819 (handler)Handler function for delete_node tool. Sends 'delete_node' command with nodeId to Figma plugin and returns success/error message.async ({ nodeId }: any) => { 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 delete_node tool requiring nodeId as string.{ nodeId: z.string().describe("The ID of the node to delete"), },
- TypeScript type definition for delete_node command parameters in CommandParams interface.delete_node: { nodeId: string; };