Skip to main content
Glama

get_current_view_elements

Retrieve elements from the active Revit view, filtering by model or annotation categories. Optionally include hidden elements and set a limit on returned results for precise data extraction.

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

NameRequiredDescriptionDefault
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
modelCategoryListNoList of Revit model category names (e.g., 'OST_Walls', 'OST_Doors', 'OST_Floors')

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "annotationCategoryList": { "description": "List of Revit annotation category names (e.g., 'OST_Dimensions', 'OST_WallTags', 'OST_TextNotes')", "items": { "type": "string" }, "type": "array" }, "includeHidden": { "description": "Whether to include hidden elements in the results", "type": "boolean" }, "limit": { "description": "Maximum number of elements to return", "type": "number" }, "modelCategoryList": { "description": "List of Revit model category names (e.g., 'OST_Walls', 'OST_Doors', 'OST_Floors')", "items": { "type": "string" }, "type": "array" } }, "type": "object" }

Implementation Reference

  • The tool handler that processes input arguments, sends the 'get_current_view_elements' command to the Revit client using withRevitConnection, and formats the response or error as MCP content.
    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-based input schema defining optional parameters for filtering elements by category, 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"), },
  • The registration function that adds the 'get_current_view_elements' tool to the MCP server, including name, description, schema, and handler. This is dynamically invoked by 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) }`, }, ], }; } } ); }
  • src/index.ts:26-26 (registration)
    Top-level call to registerTools which dynamically loads and registers all individual tool registration functions, including get_current_view_elements.
    await registerTools(server);

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