Skip to main content
Glama

create_surface_based_element

Create floors, ceilings, or roofs in Revit by defining boundaries, thickness, and level parameters in millimeters for batch processing.

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
NameRequiredDescriptionDefault
dataYesArray of surface-based elements to create

Implementation Reference

  • Handler function that processes input parameters, establishes Revit connection, sends the create_surface_based_element command, and formats 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 tool, including array of elements with name, typeId, boundary (with outerLoop of line segments), 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"),
    },
  • Registration function that sets up the MCP tool on the server with name, description, 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)
                  }`,
                },
              ],
            };
          }
        }
      );
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the unit system (millimeters) and batch creation, but lacks disclosure of side effects, prerequisites (e.g., open document), error behavior, or what happens on failure. For a mutating tool, this is a notable gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the core purpose, followed by batch capability, parameter highlights, and units. Every sentence contributes meaningful information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the detailed schema and lack of output schema/annotations, the description covers the high-level purpose, examples, batch aspect, and units. It lacks explicit error-handling or prerequisite information, but the overall context is sufficient for an agent to select and invoke the tool appropriately.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 100% property descriptions, so the baseline is 3. The description adds valuable context beyond the schema by specifying units (mm) and clarifying the tool accepts multiple elements in an array (batch). This extra semantic guidance raises the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool creates surface-based elements (floors, ceilings, roofs) with a specific verb and resource, distinguishing it from sibling tools like create_line_based_element and create_point_based_element. It also mentions batch creation, adding further specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by explicitly naming surface-based elements (floors, ceilings, roofs) and noting batch creation, which differentiates it from line/point-based alternatives. It does not provide explicit when-not-to-use or alternative tool references, but the examples and scope sufficiently guide an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.