create_surface_based_element
Generate floors, ceilings, or roofs in Revit by defining boundaries, thickness, and levels. Enables batch creation with precise parameters for surface-based elements, all in millimeters.
Instructions
Create one or more surface-based elements in Revit such as floors, ceilings, or roofs. Supports batch creation with detailed parameters including family type ID, boundary lines, thickness, and level information. All units are in millimeters (mm).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Array of surface-based elements to create |
Implementation Reference
- The handler function for the MCP tool 'create_surface_based_element'. It processes the input parameters, sends a command to the Revit client using withRevitConnection, and returns the response or error.async (args, extra) => { const params = args; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand( "create_surface_based_element", params ); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Create surface-based element failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
- Zod schema defining the input parameters for the 'create_surface_based_element' tool, including name, typeId, boundary (with outerLoop lines), thickness, baseLevel, and baseOffset.{ data: z .array( z.object({ name: z .string() .describe("Description of the element (e.g., floor, ceiling)"), typeId: z .number() .optional() .describe("The ID of the family type to create."), boundary: z .object({ outerLoop: z .array( z.object({ p0: z.object({ x: z.number().describe("X coordinate of start point"), y: z.number().describe("Y coordinate of start point"), z: z.number().describe("Z coordinate of start point"), }), p1: z.object({ x: z.number().describe("X coordinate of end point"), y: z.number().describe("Y coordinate of end point"), z: z.number().describe("Z coordinate of end point"), }), }) ) .min(3) .describe("Array of line segments defining the boundary"), }) .describe("Boundary definition with outer loop"), thickness: z.number().describe("Thickness of the element"), baseLevel: z.number().describe("Base level height"), baseOffset: z.number().describe("Offset from the base level"), }) ) .describe("Array of surface-based elements to create"), },
- src/tools/create_surface_based_element.ts:5-80 (registration)The registration function that sets up the MCP tool 'create_surface_based_element' on the server, including name, description, input schema, and handler.export function registerCreateSurfaceBasedElementTool(server: McpServer) { server.tool( "create_surface_based_element", "Create one or more surface-based elements in Revit such as floors, ceilings, or roofs. Supports batch creation with detailed parameters including family type ID, boundary lines, thickness, and level information. All units are in millimeters (mm).", { data: z .array( z.object({ name: z .string() .describe("Description of the element (e.g., floor, ceiling)"), typeId: z .number() .optional() .describe("The ID of the family type to create."), boundary: z .object({ outerLoop: z .array( z.object({ p0: z.object({ x: z.number().describe("X coordinate of start point"), y: z.number().describe("Y coordinate of start point"), z: z.number().describe("Z coordinate of start point"), }), p1: z.object({ x: z.number().describe("X coordinate of end point"), y: z.number().describe("Y coordinate of end point"), z: z.number().describe("Z coordinate of end point"), }), }) ) .min(3) .describe("Array of line segments defining the boundary"), }) .describe("Boundary definition with outer loop"), thickness: z.number().describe("Thickness of the element"), baseLevel: z.number().describe("Base level height"), baseOffset: z.number().describe("Offset from the base level"), }) ) .describe("Array of surface-based elements to create"), }, async (args, extra) => { const params = args; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand( "create_surface_based_element", params ); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Create surface-based element failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } ); }