Skip to main content
Glama

operate_element

Manages Revit elements by executing actions like selecting, hiding, deleting, or adjusting color and transparency directly within the Autodesk Revit environment using the MCP protocol.

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

  • The asynchronous handler function that processes the tool call by forwarding parameters to the Revit client via sendCommand and returns the response or error.
    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 including elementIds, action, transparencyValue, and colorValue for the operate_element tool.
    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"),
  • The registration function that adds the operate_element tool to the MCP server using server.tool, including name, description, schema, and handler.
    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)}`, }, ], }; } } ); }

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

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