Skip to main content
Glama

operate_element

Perform actions on Revit elements including selection, visibility changes, color adjustments, and deletion to modify BIM models.

Instructions

Operate on Revit elements by performing actions such as select, selectionBox, setColor, setTransparency, delete, hide, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesParameters for operating on Revit elements with specific actions

Implementation Reference

  • Handler function that sends the 'operate_element' command with parameters to the Revit client via withRevitConnection and returns the response as text content or an error message.
    async (args, extra) => {
      const params = args;
    
      try {
        const response = await withRevitConnection(async (revitClient) => {
          return await revitClient.sendCommand(
            "operate_element",
            params
          );
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Operate elements failed: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the 'operate_element' tool: elementIds array, action string, optional transparencyValue and colorValue.
    {
      data: z
        .object({
          elementIds: z
            .array(z
              .number()
              .describe("A valid Revit element ID to operate on")
            )
            .describe("Array of Revit element IDs to perform the specified action on"),
          action: z
            .string()
            .describe("The operation to perform on elements. Valid values: Select, SelectionBox, SetColor, SetTransparency, Delete, Hide, TempHide, Isolate, Unhide, ResetIsolate, Highlight. Select enables direct element selection in the active view. SelectionBox allows selection of elements by drawing a rectangular window in the view. SetColor changes the color of elements (requires elementColor parameter). SetTransparency adjusts element transparency (requires transparencyValue parameter). Highlight is a convenience operation that sets elements to red color (internally calls SetColor with red). Delete permanently removes elements from the project. Hide makes elements invisible in the current view until explicitly shown. TempHide temporarily hides elements in the current view. Isolate displays only selected elements while hiding all others. Unhide reveals previously hidden elements. ResetIsolate restores normal visibility to the view."),
          transparencyValue: z
            .number()
            .default(50)
            .describe("Transparency value (0-100) for SetTransparency action. Higher values increase transparency."),
          colorValue: z
            .array(z.number())
            .default([255, 0, 0])
            .describe("RGB color values for SetColor action. Default is red [255,0,0].")
        })
        .describe("Parameters for operating on Revit elements with specific actions"),
    },
  • Function that registers the 'operate_element' MCP tool on the server, providing name, description, schema, and handler. This function is dynamically called by src/tools/register.ts.
    export function registerOperateElementTool(server: McpServer) {
      server.tool(
        "operate_element",
        "Operate on Revit elements by performing actions such as select, selectionBox, setColor, setTransparency, delete, hide, etc.",
        {
          data: z
            .object({
              elementIds: z
                .array(z
                  .number()
                  .describe("A valid Revit element ID to operate on")
                )
                .describe("Array of Revit element IDs to perform the specified action on"),
              action: z
                .string()
                .describe("The operation to perform on elements. Valid values: Select, SelectionBox, SetColor, SetTransparency, Delete, Hide, TempHide, Isolate, Unhide, ResetIsolate, Highlight. Select enables direct element selection in the active view. SelectionBox allows selection of elements by drawing a rectangular window in the view. SetColor changes the color of elements (requires elementColor parameter). SetTransparency adjusts element transparency (requires transparencyValue parameter). Highlight is a convenience operation that sets elements to red color (internally calls SetColor with red). Delete permanently removes elements from the project. Hide makes elements invisible in the current view until explicitly shown. TempHide temporarily hides elements in the current view. Isolate displays only selected elements while hiding all others. Unhide reveals previously hidden elements. ResetIsolate restores normal visibility to the view."),
              transparencyValue: z
                .number()
                .default(50)
                .describe("Transparency value (0-100) for SetTransparency action. Higher values increase transparency."),
              colorValue: z
                .array(z.number())
                .default([255, 0, 0])
                .describe("RGB color values for SetColor action. Default is red [255,0,0].")
            })
            .describe("Parameters for operating on Revit elements with specific actions"),
        },
        async (args, extra) => {
          const params = args;
    
          try {
            const response = await withRevitConnection(async (revitClient) => {
              return await revitClient.sendCommand(
                "operate_element",
                params
              );
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(response, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `Operate elements failed: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
            };
          }
        }
      );
    }
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 of behavioral disclosure. While it lists actions like 'delete' (implying destructive operations) and 'select' (implying non-destructive), it doesn't clarify permissions needed, reversibility of actions, or side effects. For example, it mentions 'Delete permanently removes elements' but doesn't warn about data loss or confirmations. This is inadequate for a multi-action tool with potentially destructive behaviors.

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

Conciseness4/5

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

The description is appropriately concise and front-loaded, stating the core purpose in the first sentence and listing key actions. However, the detailed explanations of action values are embedded in the schema description rather than the tool description itself, which keeps the main description lean but might split context. Overall, it's efficient with minimal waste.

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

Completeness3/5

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

Given the tool's complexity (multiple actions with varying behaviors), lack of annotations, and no output schema, the description is moderately complete. It covers the action semantics well but misses critical behavioral details like permissions, reversibility, and error handling. For a tool with destructive operations like 'delete', this gap is significant, though the parameter explanations provide some mitigation.

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 description adds significant value beyond the input schema, which has 100% coverage. It explains the semantics of the 'action' parameter by detailing what each value does (e.g., 'Select enables direct element selection', 'Delete permanently removes elements'), providing context that the schema's enum descriptions don't fully capture. This compensates for the schema's technical but less intuitive parameter definitions, making the tool's functionality clearer.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Operate on Revit elements by performing actions such as select, selectionBox, setColor, setTransparency, delete, hide, etc.' It specifies the verb ('operate on') and resource ('Revit elements'), and lists example actions. However, it doesn't explicitly differentiate from siblings like 'delete_element' or 'color_elements' that handle specific operations, leaving some ambiguity about when to use this multi-action tool versus specialized ones.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'delete_element' and 'color_elements' that handle specific actions, there's no indication whether this tool is a comprehensive alternative or has different use cases. It lacks explicit when/when-not instructions or prerequisites, leaving the agent to infer usage from the action list alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ideook/revit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server