Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

delete_node

Remove design elements from Figma files using node IDs to manage and update visual content.

Instructions

Delete a node from Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to delete

Implementation Reference

  • The full implementation of the 'delete_node' MCP tool. This includes the registration via server.tool(), the input schema requiring a nodeId string, and the handler function that sends a 'delete_node' command to the underlying Figma plugin via WebSocket (sendCommandToFigma), handles success/error responses, and returns markdown content to the user.
    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 the delete_node tool input parameters.
    {
      nodeId: z.string().describe("The ID of the node to delete"),
    },
  • Registration of the delete_node tool in the MCP server using server.tool() method.
    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)
                  }`,
              },
            ],
          };
        }
      }
    );

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/paragdesai1/parag-Figma-MCP'

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