set_font_weight
Adjust text boldness in Figma designs by modifying font weight values from 100 to 900 for specific text elements.
Instructions
Set the font weight of a text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the text node to modify | |
| weight | Yes | Font weight (100, 200, 300, 400, 500, 600, 700, 800, 900) |
Implementation Reference
- src/talk_to_figma_mcp/tools/text-tools.ts:230-263 (registration)Registers the 'set_font_weight' MCP tool with Zod input schema (nodeId: string, weight: number) and inline handler that delegates to Figma plugin via sendCommandToFigma, returning success or error message.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)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:17-17 (registration)Higher-level registration call to registerTextTools(server), which includes the set_font_weight tool among text tools.registerTextTools(server);
- src/talk_to_figma_mcp/server.ts:34-34 (registration)Top-level registration call to registerTools(server), which chains to text-tools registration including set_font_weight.registerTools(server);
- Type definition for FigmaCommand includes 'set_font_weight' as a valid command sent from MCP handler to Figma plugin.| "set_font_weight"