Skip to main content
Glama
yhc984
by yhc984

delete_node

Remove a specific node from Figma designs by providing its ID, enabling precise editing and management of design elements programmatically.

Instructions

Delete a node from Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to delete

Implementation Reference

  • Core implementation of delete_node tool: fetches Figma node by ID, removes it with node.remove(), returns deleted node info.
    async function deleteNode(params) { const { nodeId } = params || {}; if (!nodeId) { throw new Error("Missing nodeId parameter"); } const node = await figma.getNodeByIdAsync(nodeId); if (!node) { throw new Error(`Node not found with ID: ${nodeId}`); } // Save node info before deleting const nodeInfo = { id: node.id, name: node.name, type: node.type, }; node.remove(); return nodeInfo; }
  • MCP tool registration for 'delete_node', defines schema (nodeId: string), thin handler forwarding to Figma plugin via WebSocket.
    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 definition for delete_node tool input: requires nodeId string.
    nodeId: z.string().describe("The ID of the node to delete")
  • Dispatch in handleCommand switch that routes 'delete_node' command to deleteNode handler.
    case "delete_node": return await deleteNode(params);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yhc984/cursor-talk-to-figma-mcp-main'

If you have feedback or need assistance with the MCP directory API, please join our Discord server