set_text_decoration
Apply text decoration to Figma text nodes by setting underline, strikethrough, or no decoration using node ID and decoration type parameters.
Instructions
Set the text decoration of a text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the text node to modify | |
| textDecoration | Yes | Text decoration type |
Implementation Reference
- Complete MCP tool definition for 'set_text_decoration': registers the tool with server.tool(), defines Zod input schema (nodeId: string, textDecoration: enum["NONE","UNDERLINE","STRIKETHROUGH"]), and provides handler function that sends command to Figma via sendCommandToFigma and returns success/error text response.server.tool( "set_text_decoration", "Set the text decoration of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), textDecoration: z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).describe("Text decoration type"), }, async ({ nodeId, textDecoration }) => { try { const result = await sendCommandToFigma("set_text_decoration", { nodeId, textDecoration }); const typedResult = result as { name: string, textDecoration: string }; return { content: [ { type: "text", text: `Updated text decoration of node "${typedResult.name}" to ${typedResult.textDecoration}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting text decoration: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:17-17 (registration)registerTools calls registerTextTools(server), which registers the set_text_decoration tool among others.registerTextTools(server);
- src/talk_to_figma_mcp/server.ts:34-34 (registration)Main server initialization calls registerTools(server), indirectly registering set_text_decoration.registerTools(server);
- Input schema validation using Zod for the tool parameters.{ nodeId: z.string().describe("The ID of the text node to modify"), textDecoration: z.enum(["NONE", "UNDERLINE", "STRIKETHROUGH"]).describe("Text decoration type"), },
- Type definition including 'set_text_decoration' in FigmaCommand union type.| "set_text_decoration"