Skip to main content
Glama

delete_element

Remove elements from a Revit model by specifying their element IDs. This tool enables deletion of one or multiple elements to modify project designs.

Instructions

Delete one or more elements from the Revit model by their element IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementIdsYesThe IDs of the elements to delete

Implementation Reference

  • The handler function that processes the tool call: extracts elementIds, sends 'delete_element' command to Revit client using withRevitConnection, and returns the response or error message.
    async (args, extra) => { const params = { elementIds: args.elementIds, }; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand("delete_element", params); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `delete element failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
  • Input schema definition using Zod: requires 'elementIds' as an array of strings.
    { elementIds: z .array(z.string()) .describe("The IDs of the elements to delete"), },
  • The registration function that adds the 'delete_element' tool to the MCP server, including name, description, schema, and handler. This function is dynamically called during server setup from src/tools/register.ts.
    export function registerDeleteElementTool(server: McpServer) { server.tool( "delete_element", "Delete one or more elements from the Revit model by their element IDs.", { elementIds: z .array(z.string()) .describe("The IDs of the elements to delete"), }, async (args, extra) => { const params = { elementIds: args.elementIds, }; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand("delete_element", params); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `delete element 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/ideook/revit-mcp'

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