Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

set_padding

Adjust padding values for auto-layout frames in Figma to control spacing around content within design elements.

Instructions

Set padding values for an auto-layout frame in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the frame to modify
paddingTopNoTop padding value
paddingRightNoRight padding value
paddingBottomNoBottom padding value
paddingLeftNoLeft padding value

Implementation Reference

  • MCP tool registration for 'set_padding', including schema definition, handler function that proxies the command to Figma via sendCommandToFigma, and formats success/error responses.
    server.tool(
      "set_padding",
      "Set padding values for an auto-layout frame in Figma",
      {
        nodeId: z.string().describe("The ID of the frame to modify"),
        paddingTop: z.number().optional().describe("Top padding value"),
        paddingRight: z.number().optional().describe("Right padding value"),
        paddingBottom: z.number().optional().describe("Bottom padding value"),
        paddingLeft: z.number().optional().describe("Left padding value"),
      },
      async ({ nodeId, paddingTop, paddingRight, paddingBottom, paddingLeft }) => {
        try {
          const result = await sendCommandToFigma("set_padding", {
            nodeId,
            paddingTop,
            paddingRight,
            paddingBottom,
            paddingLeft,
          });
          const typedResult = result as { name: string };
    
          // Create a message about which padding values were set
          const paddingMessages = [];
          if (paddingTop !== undefined) paddingMessages.push(`top: ${paddingTop}`);
          if (paddingRight !== undefined) paddingMessages.push(`right: ${paddingRight}`);
          if (paddingBottom !== undefined) paddingMessages.push(`bottom: ${paddingBottom}`);
          if (paddingLeft !== undefined) paddingMessages.push(`left: ${paddingLeft}`);
    
          const paddingText = paddingMessages.length > 0
            ? `padding (${paddingMessages.join(', ')})`
            : "padding";
    
          return {
            content: [
              {
                type: "text",
                text: `Set ${paddingText} for frame "${typedResult.name}"`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting padding: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Handler function for the 'set_padding' tool. It sends the padding parameters to the Figma plugin via sendCommandToFigma('set_padding', params), processes the result to get the frame name, constructs a descriptive success message indicating which paddings were set, and returns formatted MCP content or error response.
    async ({ nodeId, paddingTop, paddingRight, paddingBottom, paddingLeft }) => {
      try {
        const result = await sendCommandToFigma("set_padding", {
          nodeId,
          paddingTop,
          paddingRight,
          paddingBottom,
          paddingLeft,
        });
        const typedResult = result as { name: string };
    
        // Create a message about which padding values were set
        const paddingMessages = [];
        if (paddingTop !== undefined) paddingMessages.push(`top: ${paddingTop}`);
        if (paddingRight !== undefined) paddingMessages.push(`right: ${paddingRight}`);
        if (paddingBottom !== undefined) paddingMessages.push(`bottom: ${paddingBottom}`);
        if (paddingLeft !== undefined) paddingMessages.push(`left: ${paddingLeft}`);
    
        const paddingText = paddingMessages.length > 0
          ? `padding (${paddingMessages.join(', ')})`
          : "padding";
    
        return {
          content: [
            {
              type: "text",
              text: `Set ${paddingText} for frame "${typedResult.name}"`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting padding: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod schema defining input parameters for the 'set_padding' tool: required nodeId (string), optional paddingTop, paddingRight, paddingBottom, paddingLeft (numbers).
    {
      nodeId: z.string().describe("The ID of the frame to modify"),
      paddingTop: z.number().optional().describe("Top padding value"),
      paddingRight: z.number().optional().describe("Right padding value"),
      paddingBottom: z.number().optional().describe("Bottom padding value"),
      paddingLeft: z.number().optional().describe("Left padding value"),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a mutation ('Set padding values') but doesn't mention permissions needed, whether changes are reversible, error conditions (e.g., invalid nodeId), or side effects. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose with zero wasted words. It immediately communicates what the tool does without unnecessary elaboration, making it easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success (e.g., returns updated frame object), error handling, or important constraints like frame type requirements. Given the complexity of modifying design elements, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any parameter-specific context beyond what's in the schema (e.g., units for padding values, whether padding is in pixels, default behaviors). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Set padding values') and target resource ('an auto-layout frame in Figma'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'set_item_spacing' or 'set_layout_mode' that also modify auto-layout properties, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., the frame must already exist and be in auto-layout mode), exclusions, or comparisons to similar tools like 'set_item_spacing' for spacing between items versus padding within a frame.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/andreycretsu/cursor-talk-to-figma-mcp-main'

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