Skip to main content
Glama

set_padding

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

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 server.tool registration for the 'set_padding' tool. Includes input schema validation with Zod and the complete handler function that proxies the command to the Figma plugin.
    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)}`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema for set_padding tool defining parameters: nodeId (string), and 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"),
    },
  • Handler implementation for set_padding tool. Sends the padding parameters to Figma plugin using sendCommandToFigma and constructs a descriptive success message based on which paddings were set.
    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)}`,
            },
          ],
        };
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / nodeId
      Added value: +{
      +  "description": "The ID of the frame to modify",
      +  "type": "string"
      +}
    • addedInput schema / properties / paddingBottom
      Added value: +{
      +  "description": "Bottom padding value",
      +  "type": "number"
      +}
    • addedInput schema / properties / paddingLeft
      Added value: +{
      +  "description": "Left padding value",
      +  "type": "number"
      +}
    • addedInput schema / properties / paddingRight
      Added value: +{
      +  "description": "Right padding value",
      +  "type": "number"
      +}
    • addedInput schema / properties / paddingTop
      Added value: +{
      +  "description": "Top padding value",
      +  "type": "number"
      +}
    • addedInput schema / required
      Added value: +[
      +  "nodeId"
      +]
  2. First observed

TDQS

A3.5/5.0
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It merely states the action without revealing whether padding values are merged or replaced, what happens if the node is not an auto-layout frame, or any side effects or failure modes.

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, front-loaded sentence that conveys the core purpose without any wasted words. It is appropriately sized for the tool's simplicity.

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

Completeness3/5

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

The schema covers parameter meanings, and the description states the purpose, but critical behavioral details (merge vs replace, error handling) are missing. For a mutation tool with no output schema, this is adequate but not fully complete for safe autonomous use.

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?

The input schema already describes all parameters in full (100% coverage), so the description adds little beyond identifying the target as an auto-layout frame. It does not clarify the relationship between parameters (e.g., setting only one side).

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

Purpose5/5

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

The description uses a specific verb ('Set') and resource ('padding values') with a clear target ('auto-layout frame'), distinguishing it from sibling tools like set_item_spacing or set_corner_radius. It unambiguously states the tool's function.

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

Usage Guidelines3/5

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

The description implies the tool is only for auto-layout frames, giving some context, but it does not explicitly state when to use this tool over alternatives or when not to use it. No exclusions or alternative tool references are provided.

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