Skip to main content
Glama

get_current_view_elements

Retrieve elements from Revit's active view, filter by model or annotation categories, control visibility of hidden elements, and limit results for efficient project analysis.

Instructions

Get elements from the current active view in Revit. You can filter by model categories (like Walls, Floors) or annotation categories (like Dimensions, Text). Use includeHidden to show/hide invisible elements and limit to control the number of returned elements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelCategoryListNoList of Revit model category names (e.g., 'OST_Walls', 'OST_Doors', 'OST_Floors')
annotationCategoryListNoList of Revit annotation category names (e.g., 'OST_Dimensions', 'OST_WallTags', 'OST_TextNotes')
includeHiddenNoWhether to include hidden elements in the results
limitNoMaximum number of elements to return

Implementation Reference

  • The main handler function that processes input arguments, prepares parameters, connects to Revit via withRevitConnection, sends the 'get_current_view_elements' command, and formats the response or error message.
    async (args, extra) => {
      const params = {
        modelCategoryList: args.modelCategoryList || [],
        annotationCategoryList: args.annotationCategoryList || [],
        includeHidden: args.includeHidden || false,
        limit: args.limit || 100,
      };
    
      try {
        const response = await withRevitConnection(async (revitClient) => {
          return await revitClient.sendCommand(
            "get_current_view_elements",
            params
          );
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `get current view elements failed: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod input schema defining optional parameters for filtering elements by model/annotation categories, including hidden elements, and limiting results.
    {
      modelCategoryList: z
        .array(z.string())
        .optional()
        .describe(
          "List of Revit model category names (e.g., 'OST_Walls', 'OST_Doors', 'OST_Floors')"
        ),
      annotationCategoryList: z
        .array(z.string())
        .optional()
        .describe(
          "List of Revit annotation category names (e.g., 'OST_Dimensions', 'OST_WallTags', 'OST_TextNotes')"
        ),
      includeHidden: z
        .boolean()
        .optional()
        .describe("Whether to include hidden elements in the results"),
      limit: z
        .number()
        .optional()
        .describe("Maximum number of elements to return"),
    },
  • Registration function that adds the 'get_current_view_elements' tool to the MCP server using server.tool(), providing name, description, schema, and handler. This is dynamically called from src/tools/register.ts.
    export function registerGetCurrentViewElementsTool(server: McpServer) {
      server.tool(
        "get_current_view_elements",
        "Get elements from the current active view in Revit. You can filter by model categories (like Walls, Floors) or annotation categories (like Dimensions, Text). Use includeHidden to show/hide invisible elements and limit to control the number of returned elements.",
        {
          modelCategoryList: z
            .array(z.string())
            .optional()
            .describe(
              "List of Revit model category names (e.g., 'OST_Walls', 'OST_Doors', 'OST_Floors')"
            ),
          annotationCategoryList: z
            .array(z.string())
            .optional()
            .describe(
              "List of Revit annotation category names (e.g., 'OST_Dimensions', 'OST_WallTags', 'OST_TextNotes')"
            ),
          includeHidden: z
            .boolean()
            .optional()
            .describe("Whether to include hidden elements in the results"),
          limit: z
            .number()
            .optional()
            .describe("Maximum number of elements to return"),
        },
        async (args, extra) => {
          const params = {
            modelCategoryList: args.modelCategoryList || [],
            annotationCategoryList: args.annotationCategoryList || [],
            includeHidden: args.includeHidden || false,
            limit: args.limit || 100,
          };
    
          try {
            const response = await withRevitConnection(async (revitClient) => {
              return await revitClient.sendCommand(
                "get_current_view_elements",
                params
              );
            });
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(response, null, 2),
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: "text",
                  text: `get current view elements failed: ${
                    error instanceof Error ? error.message : String(error)
                  }`,
                },
              ],
            };
          }
        }
      );
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that the tool retrieves elements from the current view, supports filtering by categories, and includes options for hidden elements and result limits. However, it doesn't cover critical behavioral aspects like performance implications, error handling, permissions needed, or what happens if no view is active, leaving gaps for a tool with mutation-like context.

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 efficiently structured in two sentences: the first states the core purpose with examples, and the second explains key parameters concisely. Every sentence adds value without redundancy, making it easy to scan and understand quickly.

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 4 parameters with full schema coverage but no annotations or output schema, the description provides adequate context for basic usage but lacks depth. It doesn't explain return values, error conditions, or integration with sibling tools, which is a gap for a tool in a complex environment like Revit with many related operations.

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

Parameters3/5

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

Schema description coverage is 100%, providing clear documentation for all parameters. The description adds value by explaining the purpose of filtering ('model categories like Walls, Floors' and 'annotation categories like Dimensions, Text') and the effects of 'includeHidden' and 'limit', but doesn't go beyond the schema's details. Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('Get elements') and resource ('from the current active view in Revit'), with specific filtering capabilities mentioned. It distinguishes itself from siblings like 'get_selected_elements' by focusing on the current view rather than selected elements, but doesn't explicitly contrast with 'ai_element_filter' or other view-related tools.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning filtering by model/annotation categories and controlling visibility/quantity, suggesting when to use these parameters. However, it lacks explicit guidance on when to choose this tool over alternatives like 'get_selected_elements' or 'ai_element_filter', and doesn't mention prerequisites or exclusions.

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