Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

set_font_name

Change font family and style for text elements in Figma designs using node IDs to maintain typography consistency.

Instructions

Set the font name and style of a text node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the text node to modify
familyYesFont family name
styleNoFont style (e.g., 'Regular', 'Bold', 'Italic')

Implementation Reference

  • The handler function for the 'set_font_name' tool. It sends a command to Figma via sendCommandToFigma, processes the result, and returns a success or error message in MCP content format.
      async ({ nodeId, family, style }) => {
        try {
          const result = await sendCommandToFigma("set_font_name", {
            nodeId,
            family,
            style
          });
          const typedResult = result as { name: string, fontName: { family: string, style: string } };
          return {
            content: [
              {
                type: "text",
                text: `Updated font of node "${typedResult.name}" to ${typedResult.fontName.family} ${typedResult.fontName.style}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting font name: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Input schema (Zod) for the 'set_font_name' tool defining parameters: nodeId (string), family (string), style (optional string).
    {
      nodeId: z.string().describe("The ID of the text node to modify"),
      family: z.string().describe("Font family name"),
      style: z.string().optional().describe("Font style (e.g., 'Regular', 'Bold', 'Italic')"),
    },
  • Registration of the 'set_font_name' MCP tool using server.tool(), including description, input schema, and handler function.
    server.tool(
      "set_font_name",
      "Set the font name and style of a text node in Figma",
      {
        nodeId: z.string().describe("The ID of the text node to modify"),
        family: z.string().describe("Font family name"),
        style: z.string().optional().describe("Font style (e.g., 'Regular', 'Bold', 'Italic')"),
      },
      async ({ nodeId, family, style }) => {
        try {
          const result = await sendCommandToFigma("set_font_name", {
            nodeId,
            family,
            style
          });
          const typedResult = result as { name: string, fontName: { family: string, style: string } };
          return {
            content: [
              {
                type: "text",
                text: `Updated font of node "${typedResult.name}" to ${typedResult.fontName.family} ${typedResult.fontName.style}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting font name: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Type definition for internal Figma commands includes 'set_font_name' for type safety in sendCommandToFigma calls.
    export type FigmaCommand =
      | "get_document_info"
      | "get_selection"
      | "get_node_info"
      | "create_rectangle"
      | "create_frame"
      | "create_text"
      | "create_ellipse"
      | "create_polygon"
      | "create_star"
      | "create_vector"
      | "create_line"
      | "set_fill_color"
      | "set_stroke_color"
      | "move_node"
      | "resize_node"
      | "delete_node"
      | "get_styles"
      | "get_local_components"
      | "get_team_components"
      | "create_component_instance"
      | "export_node_as_image"
      | "join"
      | "set_corner_radius"
      | "clone_node"
      | "set_text_content"
      | "scan_text_nodes"
      | "set_multiple_text_contents"
      | "set_auto_layout"
      | "set_font_name"
      | "set_font_size"
      | "set_font_weight"
      | "set_letter_spacing"
      | "set_line_height"
      | "set_paragraph_spacing"
      | "set_text_case"
      | "set_text_decoration"
      | "get_styled_text_segments"
      | "load_font_async"
      | "get_remote_components"
      | "set_effects"
      | "set_effect_style_id"
      | "group_nodes"
      | "ungroup_nodes"
      | "flatten_node"
      | "insert_child";
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'modify' which implies mutation, but doesn't disclose behavioral traits like whether this requires specific permissions, if changes are reversible, what happens with invalid font names, or error handling. The description is minimal and lacks operational context.

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 with zero wasted words. It's front-loaded with the core action and resource, making it immediately understandable without unnecessary elaboration.

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 inadequate. It doesn't explain what happens on success/failure, return values, or error conditions. Given the complexity of font operations in design tools, more context about font availability, fallback behavior, or visual changes would be 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%, providing clear documentation for all three parameters. The description adds no additional parameter semantics beyond what's in the schema, such as format examples for 'family' or 'style' beyond the schema's example. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the specific action ('Set'), target resource ('font name and style of a text node'), and platform context ('in Figma'). It distinguishes from siblings like 'set_font_size' or 'set_font_weight' by focusing on font family and style selection rather than size or weight adjustments.

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?

The description provides no guidance on when to use this tool versus alternatives like 'set_font_weight' or 'set_font_size', nor does it mention prerequisites such as needing a valid text node ID or font availability. It simply states what the tool does without contextual usage information.

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/arinspunk/claude-talk-to-figma-mcp'

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