insert_child
Add a child node within a parent node in Figma using natural language commands, enabling structured design manipulation through AI integration.
Instructions
Insert a child node inside a parent node 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
- src/talk_to_figma_mcp/tools/creation-tools.ts:539-581 (registration)Registers the 'insert_child' MCP tool on the server, including input schema using Zod and the handler function that sends the insert_child command to the Figma plugin via sendCommandToFigma utility.server.tool( "insert_child", "Insert a child node inside a parent node in Figma", { parentId: z.string().describe("ID of the parent node where the child will be inserted"), childId: z.string().describe("ID of the child node to insert"), index: z.number().optional().describe("Optional index where to insert the child (if not specified, it will be added at the end)") }, async ({ parentId, childId, index }) => { try { const result = await sendCommandToFigma("insert_child", { parentId, childId, index }); const typedResult = result as { parentId: string, childId: string, index: number, success: boolean }; return { content: [ { type: "text", text: `Child node with ID: ${typedResult.childId} successfully inserted into parent node with ID: ${typedResult.parentId}${index !== undefined ? ` at position ${typedResult.index}` : ''}.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error inserting child node: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Includes 'insert_child' in the FigmaCommand type union used for type safety in command sending.| "insert_child";
- src/talk_to_figma_mcp/tools/index.ts:15-15 (registration)Calls registerCreationTools which includes the insert_child tool registration.registerCreationTools(server);