create_ellipse
Add elliptical shapes to Figma designs by specifying position, dimensions, and styling options like fill and stroke colors.
Instructions
Create a new ellipse in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X position | |
| y | Yes | Y position | |
| width | Yes | Width of the ellipse | |
| height | Yes | Height of the ellipse | |
| name | No | Optional name for the ellipse | |
| parentId | No | Optional parent node ID to append the ellipse to | |
| fillColor | No | Fill color in RGBA format | |
| strokeColor | No | Stroke color in RGBA format | |
| strokeWeight | No | Stroke weight |
Implementation Reference
- The handler function for the 'create_ellipse' MCP tool. It sends a 'create_ellipse' command to Figma via websocket with provided parameters and returns a success message with the new ellipse ID or an error message.async ({ x, y, width, height, name, parentId, fillColor, strokeColor, strokeWeight }) => { try { const result = await sendCommandToFigma("create_ellipse", { x, y, width, height, name: name || "Ellipse", parentId, fillColor, strokeColor, strokeWeight, }); const typedResult = result as { id: string, name: string }; return { content: [ { type: "text", text: `Created ellipse with ID: ${typedResult.id}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating ellipse: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod input schema defining parameters for the create_ellipse tool: position (x,y), dimensions (width,height), optional name, parentId, fillColor, strokeColor, strokeWeight.{ x: z.number().describe("X position"), y: z.number().describe("Y position"), width: z.number().describe("Width of the ellipse"), height: z.number().describe("Height of the ellipse"), name: z.string().optional().describe("Optional name for the ellipse"), parentId: z.string().optional().describe("Optional parent node ID to append the ellipse 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:217-281 (registration)Full registration of the 'create_ellipse' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.server.tool( "create_ellipse", "Create a new ellipse in Figma", { x: z.number().describe("X position"), y: z.number().describe("Y position"), width: z.number().describe("Width of the ellipse"), height: z.number().describe("Height of the ellipse"), name: z.string().optional().describe("Optional name for the ellipse"), parentId: z.string().optional().describe("Optional parent node ID to append the ellipse 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, name, parentId, fillColor, strokeColor, strokeWeight }) => { try { const result = await sendCommandToFigma("create_ellipse", { x, y, width, height, name: name || "Ellipse", parentId, fillColor, strokeColor, strokeWeight, }); const typedResult = result as { id: string, name: string }; return { content: [ { type: "text", text: `Created ellipse with ID: ${typedResult.id}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error creating ellipse: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:12-18 (registration)Top-level registration function that calls registerCreationTools(server), which registers the create_ellipse tool among others.export function registerTools(server: McpServer): void { registerDocumentTools(server); registerCreationTools(server); registerModificationTools(server); registerTextTools(server); registerComponentTools(server); }
- TypeScript union type FigmaCommand that includes 'create_ellipse' as one of the supported Figma commands used in the codebase.export type FigmaCommand = | "get_document_info" | "get_selection" | "get_node_info" | "create_rectangle" | "create_frame" | "create_text" | "create_ellipse" | "create_polygon" | "create_star" | "create_vector" | "create_line" | "set_fill_color" | "set_stroke_color" | "move_node" | "resize_node" | "delete_node" | "get_styles" | "get_local_components" | "get_team_components" | "create_component_instance" | "export_node_as_image" | "join" | "set_corner_radius" | "clone_node" | "set_text_content" | "scan_text_nodes" | "set_multiple_text_contents" | "set_auto_layout" | "set_font_name" | "set_font_size" | "set_font_weight" | "set_letter_spacing" | "set_line_height" | "set_paragraph_spacing" | "set_text_case" | "set_text_decoration" | "get_styled_text_segments" | "load_font_async" | "get_remote_components" | "set_effects" | "set_effect_style_id" | "group_nodes" | "ungroup_nodes" | "flatten_node" | "insert_child";