set_text_content
Update the content of existing text nodes in Figma programmatically. Simplifies design automation by enabling direct text modifications through AI-driven interactions.
Instructions
Set the text content of an existing text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:904-939 (registration)The registration of the 'set_text_content' MCP tool, including its schema (input parameters: nodeId and text) and handler function that forwards the command to the Figma plugin via sendCommandToFigma and handles the response.// Set Text Content Tool server.tool( "set_text_content", "Set the text content of an existing text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), text: z.string().describe("New text content"), }, async ({ nodeId, text }) => { try { const result = await sendCommandToFigma("set_text_content", { nodeId, text, }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Updated text content of node "${typedResult.name}" to "${text}"`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error setting text content: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );