set_text_case
Change the text case of a Figma text node using natural language commands, enabling quick formatting adjustments within AI-assisted design workflows.
Instructions
Set the text case of a text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Handler function that executes the set_text_case tool by sending a command to Figma via sendCommandToFigma and returning a formatted response with success or error message.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)}` } ] }; } } );
- Zod schema defining input parameters: 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"), },
- src/talk_to_figma_mcp/tools/text-tools.ts:378-411 (registration)Registers the set_text_case MCP tool on the server with description, input schema, and handler function.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)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:17-17 (registration)Higher-level registration call to registerTextTools within the overall tools registration, which includes the set_text_case tool.registerTextTools(server);
- Type definition including 'set_text_case' in FigmaCommand union type for TypeScript safety.| "set_text_case"