Skip to main content
Glama

delete_element

Remove specific elements from a Revit model using their element IDs to manage and clean up project data.

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 implements the logic for the 'delete_element' tool. It prepares parameters from the input args, uses withRevitConnection to send a 'delete_element' command to the Revit client, and returns the response or an 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)
              }`,
            },
          ],
        };
      }
    }
  • The Zod input schema for the 'delete_element' tool, defining '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, input schema, and handler function.
    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)
                  }`,
                },
              ],
            };
          }
        }
      );
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states the tool deletes elements but doesn't disclose critical traits like whether deletions are permanent/undoable, permission requirements, rate limits, error handling for invalid IDs, or what happens if some IDs fail. This is inadequate for a destructive operation.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it immediately understandable without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a destructive tool with no annotations and no output schema, the description is incomplete. It lacks essential context like return values (success/failure indicators), error conditions, or behavioral nuances (e.g., batch processing effects). For a mutation tool in a modeling environment, this leaves significant gaps.

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%, with the parameter 'elementIds' clearly documented in the schema. The description adds no additional meaning beyond implying the IDs are for deletion, which aligns with the schema. 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.

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 ('Delete') and target resource ('elements from the Revit model'), specifying the mechanism ('by their element IDs'). It distinguishes itself from sibling tools like 'operate_element' or 'get_selected_elements' by focusing exclusively on deletion.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing valid element IDs), exclusions (e.g., not for bulk deletion of all elements), or suggest sibling tools like 'get_selected_elements' for obtaining IDs first.

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