set_text_case
Change text case in Figma design files by modifying text nodes to UPPER, LOWER, TITLE, or ORIGINAL case through Claude AI commands.
Instructions
Set the text case of a text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the text node to modify | |
| textCase | Yes | Text case type |
Implementation Reference
- src/talk_to_figma_mcp/tools/text-tools.ts:378-411 (registration)MCP tool registration for 'set_text_case', including schema validation with Zod and handler that sends the command to Figma plugin and returns success/error message.
server.tool( "set_text_case", "Set the text case of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), textCase: z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE"]).describe("Text case type"), }, async ({ nodeId, textCase }) => { try { const result = await sendCommandToFigma("set_text_case", { nodeId, textCase }); const typedResult = result as { name: string, textCase: string }; return { content: [ { type: "text", text: `Updated text case of node "${typedResult.name}" to ${typedResult.textCase}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting text case: ${error instanceof Error ? error.message : String(error)}` } ] }; } } ); - Handler function for the 'set_text_case' tool that executes the logic by calling sendCommandToFigma and formats the response.
async ({ nodeId, textCase }) => { try { const result = await sendCommandToFigma("set_text_case", { nodeId, textCase }); const typedResult = result as { name: string, textCase: string }; return { content: [ { type: "text", text: `Updated text case of node "${typedResult.name}" to ${typedResult.textCase}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting text case: ${error instanceof Error ? error.message : String(error)}` } ] }; } } - Input schema for 'set_text_case' tool using Zod: nodeId (string) and textCase (enum: ORIGINAL, UPPER, LOWER, TITLE).
{ nodeId: z.string().describe("The ID of the text node to modify"), textCase: z.enum(["ORIGINAL", "UPPER", "LOWER", "TITLE"]).describe("Text case type"), }, - 'set_text_case' included in FigmaCommand type union for internal type safety when sending commands.
| "set_text_case"