create_star
Design stars directly in Figma using natural language commands via Claude AI integration, simplifying creative workflows and enabling quick design adjustments.
Instructions
Create a new star in Figma
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- Handler function that executes the create_star tool logic by sending command to Figma WebSocket and formatting response.async ({ x, y, width, height, points, innerRadius, name, parentId, fillColor, strokeColor, strokeWeight }) => { try { const result = await sendCommandToFigma("create_star", { x, y, width, height, points: points || 5, innerRadius: innerRadius || 0.5, name: name || "Star", parentId, fillColor, strokeColor, strokeWeight, }); const typedResult = result as { id: string, name: string }; return { content: [ { type: "text", text: `Created star with ID: ${typedResult.id}, ${points || 5} points, and inner radius ratio of ${innerRadius || 0.5}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating star: ${error instanceof Error ? error.message : String(error)}` } ] }; }
- Input schema using Zod for validating parameters of the create_star tool.{ x: z.number().describe("X position"), y: z.number().describe("Y position"), width: z.number().describe("Width of the star"), height: z.number().describe("Height of the star"), points: z.number().min(3).optional().describe("Number of points (default: 5)"), innerRadius: z.number().min(0.01).max(0.99).optional().describe("Inner radius ratio (0.01-0.99, default: 0.5)"), name: z.string().optional().describe("Optional name for the star"), parentId: z.string().optional().describe("Optional parent node ID to append the star to"), fillColor: z .object({ r: z.number().min(0).max(1).describe("Red component (0-1)"), g: z.number().min(0).max(1).describe("Green component (0-1)"), b: z.number().min(0).max(1).describe("Blue component (0-1)"), a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)"), }) .optional() .describe("Fill color in RGBA format"), strokeColor: z .object({ r: z.number().min(0).max(1).describe("Red component (0-1)"), g: z.number().min(0).max(1).describe("Green component (0-1)"), b: z.number().min(0).max(1).describe("Blue component (0-1)"), a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)"), }) .optional() .describe("Stroke color in RGBA format"), strokeWeight: z.number().positive().optional().describe("Stroke weight"), },
- src/talk_to_figma_mcp/tools/creation-tools.ts:353-421 (registration)Registration of the create_star MCP tool on the server using server.tool() with name, description, input schema, and handler function.server.tool( "create_star", "Create a new star in Figma", { x: z.number().describe("X position"), y: z.number().describe("Y position"), width: z.number().describe("Width of the star"), height: z.number().describe("Height of the star"), points: z.number().min(3).optional().describe("Number of points (default: 5)"), innerRadius: z.number().min(0.01).max(0.99).optional().describe("Inner radius ratio (0.01-0.99, default: 0.5)"), name: z.string().optional().describe("Optional name for the star"), parentId: z.string().optional().describe("Optional parent node ID to append the star to"), fillColor: z .object({ r: z.number().min(0).max(1).describe("Red component (0-1)"), g: z.number().min(0).max(1).describe("Green component (0-1)"), b: z.number().min(0).max(1).describe("Blue component (0-1)"), a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)"), }) .optional() .describe("Fill color in RGBA format"), strokeColor: z .object({ r: z.number().min(0).max(1).describe("Red component (0-1)"), g: z.number().min(0).max(1).describe("Green component (0-1)"), b: z.number().min(0).max(1).describe("Blue component (0-1)"), a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)"), }) .optional() .describe("Stroke color in RGBA format"), strokeWeight: z.number().positive().optional().describe("Stroke weight"), }, async ({ x, y, width, height, points, innerRadius, name, parentId, fillColor, strokeColor, strokeWeight }) => { try { const result = await sendCommandToFigma("create_star", { x, y, width, height, points: points || 5, innerRadius: innerRadius || 0.5, name: name || "Star", parentId, fillColor, strokeColor, strokeWeight, }); const typedResult = result as { id: string, name: string }; return { content: [ { type: "text", text: `Created star with ID: ${typedResult.id}, ${points || 5} points, and inner radius ratio of ${innerRadius || 0.5}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating star: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );