Skip to main content
Glama

get_current_view_elements

Retrieve elements from Revit's active view, filtering by model or annotation categories, controlling visibility of hidden elements, and limiting results.

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 for the 'get_current_view_elements' tool. It processes input arguments, sends a command to the Revit client via withRevitConnection, and returns the response as JSON or an 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 schema defining the input parameters for the tool: modelCategoryList, annotationCategoryList, includeHidden, and limit.
    {
      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"),
    },
  • Function that registers the 'get_current_view_elements' tool on the MCP server, including name, description, schema, and handler.
    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 the full burden of behavioral disclosure. It describes filtering capabilities and optional parameters (includeHidden, limit) but doesn't mention performance characteristics, rate limits, authentication needs, or what happens when no elements match filters. It adequately describes the core behavior but lacks deeper operational 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, the second explains key parameters. Every sentence adds value with no redundant information. It's appropriately sized and front-loaded with the main functionality.

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 tool's moderate complexity (4 parameters, no output schema, no annotations), the description is reasonably complete. It covers the main functionality and parameters but doesn't explain return values or error conditions. For a read operation with good schema coverage, this is adequate though not exhaustive.

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%, so the schema already fully documents all 4 parameters. The description adds minimal value beyond the schema by mentioning the same parameters (model categories, annotation categories, includeHidden, limit) without providing additional syntax, format details, or examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 specific action ('Get elements'), target resource ('from the current active view in Revit'), and distinguishes from siblings by specifying filtering capabilities. It explicitly mentions filtering by model and annotation categories, which differentiates it from tools like 'get_selected_elements' or 'get_current_view_info'.

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 provides clear context about when to use this tool (to get elements from the current view with filtering options) but doesn't explicitly state when NOT to use it or name specific alternatives. It implies usage for filtered element retrieval but lacks explicit exclusion guidance compared to siblings like 'get_selected_elements' or 'ai_element_filter'.

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/mcp-servers-for-revit/revit-mcp'

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