Skip to main content
Glama

set_font_weight

Adjust the font weight of text elements in Figma using natural language commands, streamlining design consistency and customization.

Instructions

Set the font weight of a text node in Figma

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • The MCP tool handler function for 'set_font_weight'. It invokes sendCommandToFigma to update the font weight in Figma and formats a response message.
    async ({ nodeId, weight }) => { try { const result = await sendCommandToFigma("set_font_weight", { nodeId, weight }); const typedResult = result as { name: string, fontName: { family: string, style: string }, weight: number }; return { content: [ { type: "text", text: `Updated font weight of node "${typedResult.name}" to ${typedResult.weight} (${typedResult.fontName.style})` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting font weight: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Zod input schema defining parameters for the set_font_weight tool: nodeId (string) and weight (number).
    { nodeId: z.string().describe("The ID of the text node to modify"), weight: z.number().describe("Font weight (100, 200, 300, 400, 500, 600, 700, 800, 900)"), },
  • Registration of the 'set_font_weight' MCP tool using server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "set_font_weight", "Set the font weight of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), weight: z.number().describe("Font weight (100, 200, 300, 400, 500, 600, 700, 800, 900)"), }, async ({ nodeId, weight }) => { try { const result = await sendCommandToFigma("set_font_weight", { nodeId, weight }); const typedResult = result as { name: string, fontName: { family: string, style: string }, weight: number }; return { content: [ { type: "text", text: `Updated font weight of node "${typedResult.name}" to ${typedResult.weight} (${typedResult.fontName.style})` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting font weight: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • Invocation of registerTextTools which registers the set_font_weight tool among other text tools.
    registerTextTools(server);
  • Type definition in FigmaCommand union type, used for internal command typing to Figma plugin.
    | "set_font_weight"

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