Skip to main content
Glama

set_font_name

Change the font family and style for text elements in Figma designs by specifying the node ID and desired typography.

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

  • Registers the 'set_font_name' MCP tool on the server, defining its description, input schema (nodeId, family, style), and handler function that forwards the command to Figma via websocket and formats the response.
    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)}` } ] }; } } );
  • The core handler logic for the 'set_font_name' tool: sends the command to Figma, type-casts the result, and returns a formatted text response or error.
    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)}` } ] }; } }
  • Zod schema for input 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')"), },
  • Type definition including 'set_font_name' in the FigmaCommand union type for internal command validation.
    | "set_font_name"
  • Calls registerTextTools which includes registration of 'set_font_name' tool.
    registerTextTools(server);

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/agenisea/cc-fig-mcp'

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