Skip to main content
Glama

set_font_size

Adjust text font size in Figma by specifying the node ID and pixel value to modify design elements through the CC Fig MCP server.

Instructions

Set the font size of a text node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the text node to modify
fontSizeYesFont size in pixels

Implementation Reference

  • The handler function that implements the core logic of the set_font_size tool: sends the command to Figma via websocket, processes the response, and returns a success or error message.
    async ({ nodeId, fontSize }) => { try { const result = await sendCommandToFigma("set_font_size", { nodeId, fontSize }); const typedResult = result as { name: string, fontSize: number }; return { content: [ { type: "text", text: `Updated font size of node "${typedResult.name}" to ${typedResult.fontSize}px` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting font size: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Zod schema defining the input parameters for the tool: nodeId (string) and fontSize (positive number).
    { nodeId: z.string().describe("The ID of the text node to modify"), fontSize: z.number().positive().describe("Font size in pixels"), },
  • The server.tool() registration call that defines and registers the set_font_size MCP tool, including its name, description, input schema, and handler function.
    server.tool( "set_font_size", "Set the font size of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), fontSize: z.number().positive().describe("Font size in pixels"), }, async ({ nodeId, fontSize }) => { try { const result = await sendCommandToFigma("set_font_size", { nodeId, fontSize }); const typedResult = result as { name: string, fontSize: number }; return { content: [ { type: "text", text: `Updated font size of node "${typedResult.name}" to ${typedResult.fontSize}px` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting font size: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • Higher-level registration call to registerTextTools(server), which includes the set_font_size tool among other text tools.
    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