Skip to main content
Glama

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";

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