create_point_based_element
Add point-based elements like doors, windows, or furniture to Revit models. Specify family type, position, dimensions, and level data for batch creation in millimeters.
Instructions
Create one or more point-based elements in Revit such as doors, windows, or furniture. Supports batch creation with detailed parameters including family type ID, position, dimensions, and level information. All units are in millimeters (mm).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Array of point-based elements to create |
Implementation Reference
- Handler function that forwards the input parameters to the Revit client using sendCommand('create_point_based_element', params) and returns the response or error.async (args, extra) => { const params = args; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand( "create_point_based_element", params ); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Create point-based element failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- Zod schema for the tool input: an array of objects specifying element details like name, typeId (optional), locationPoint (x,y,z), width, depth (opt), height, baseLevel, baseOffset, rotation (opt). Units in mm.data: z .array( z.object({ name: z .string() .describe("Description of the element (e.g., door, window)"), typeId: z .number() .optional() .describe("The ID of the family type to create."), locationPoint: z .object({ x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), }) .describe( "The position coordinates where the element will be placed" ), width: z.number().describe("Width of the element in mm"), depth: z.number().optional().describe("Depth of the element in mm"), height: z.number().describe("Height of the element in mm"), baseLevel: z.number().describe("Base level height"), baseOffset: z.number().describe("Offset from the base level"), rotation: z .number() .optional() .describe("Rotation angle in degrees (0-360)"), }) ) .describe("Array of point-based elements to create"), },
- src/tools/create_point_based_element.ts:5-75 (registration)Registration function exported as registerCreatePointBasedElementTool, called dynamically from src/tools/register.ts, which registers the tool on the McpServer with name, description, schema, and handler.export function registerCreatePointBasedElementTool(server: McpServer) { server.tool( "create_point_based_element", "Create one or more point-based elements in Revit such as doors, windows, or furniture. Supports batch creation with detailed parameters including family type ID, position, dimensions, and level information. All units are in millimeters (mm).", { data: z .array( z.object({ name: z .string() .describe("Description of the element (e.g., door, window)"), typeId: z .number() .optional() .describe("The ID of the family type to create."), locationPoint: z .object({ x: z.number().describe("X coordinate"), y: z.number().describe("Y coordinate"), z: z.number().describe("Z coordinate"), }) .describe( "The position coordinates where the element will be placed" ), width: z.number().describe("Width of the element in mm"), depth: z.number().optional().describe("Depth of the element in mm"), height: z.number().describe("Height of the element in mm"), baseLevel: z.number().describe("Base level height"), baseOffset: z.number().describe("Offset from the base level"), rotation: z .number() .optional() .describe("Rotation angle in degrees (0-360)"), }) ) .describe("Array of point-based elements to create"), }, async (args, extra) => { const params = args; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand( "create_point_based_element", params ); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Create point-based element failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } ); }