Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

delete_elements

Remove multiple elements from Revit models using batch operations with dictionary parameters. Supports integer or string element IDs and ensures data consistency through transactional processing.

Instructions

批量删除Revit元素,支持字典格式参数,支持批量操作并遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 完全匹配服务器参数处理逻辑

  • 支持字典列表格式参数,每个字典包含elementId键

  • 自动处理整数和字符串格式的elementId

  • 事务化操作确保数据一致性

  • 详细的错误处理和日志记录

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"DeleteElements" params (List[Dict[str, Union[int, str]]]): 删除参数列表,每个字典必须包含: - elementId (Union[int, str]): 要删除的元素ID

返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "elementId": "删除的元素ID", "name": "元素名称", "familyName": "族名称" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }

示例: >>> # 删除多个元素(混合格式) >>> response = delete_elements(ctx, params=[ ... {"elementId": 5943}, ... {"elementId": "5913"}, ... {"elementId": 212831} ... ]) >>> print(response) { "jsonrpc": "2.0", "result": [ {"elementId": "5943", "name": "Wall 1", "familyName": "Basic Wall"}, {"elementId": "5913", "name": "Door 1", "familyName": "Single-Flush"}, {"elementId": "212831", "name": "Window 1", "familyName": "Fixed"} ], "id": 1 }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoDeleteElements
paramsNo

Implementation Reference

  • delete_elements is included in the GENERAL_TOOLS list used for registering general purpose Revit operation tools with the FastMCP server.
    GENERAL_TOOLS = [
        get_commands, execute_commands, call_func,
        find_elements, update_elements, delete_elements, parameter_elements, get_locations, move_elements,
        show_elements, active_view, get_selected_elements,
        link_dwg_and_activate_view, get_view_data
    ]
  • Loop that registers each tool in GENERAL_TOOLS, including delete_elements, as an MCP tool using the FastMCP server.tool() decorator.
    # 注册通用工具
    for tool in GENERAL_TOOLS:
        server.tool()(tool)
  • Prompt text instructing usage of delete_elements() tool for removing unwanted elements in the asset creation strategy.
    - 使用delete_elements()移除不需要的元素
  • Test/client script sending JSON-RPC request with method 'DeleteElements' (likely the backend RPC called by the delete_elements MCP tool) to the Revit plugin.
    json_rpc_request = {
        "jsonrpc": "2.0",
        "method": "DeleteElements",
        "params": data,
    }
    
    # 发送更新元素数据
    send_tcp_data(json_rpc_request)
  • Call to register_tools(mcp) which registers the delete_elements tool among others.
    register_tools(mcp)
Behavior4/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 does an excellent job describing key behavioral traits: it explicitly states this is a batch deletion tool, mentions transactionality for data consistency, describes detailed error handling and logging, and explains the JSON-RPC 2.0 response format. The only gap is not explicitly warning about the destructive nature, though '删除' (delete) implies this.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (特性, 参数, 返回, 示例), but it's quite lengthy with technical implementation details like 'mcp_tool使用时params不要有任何注释信息' and JSON-RPC specifications that may not all be essential for tool selection. Some information could be more concise while maintaining clarity.

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?

For a destructive batch operation tool with no annotations and no output schema, the description provides substantial context: it explains the operation, parameters, return format, and includes a detailed example. The main gap is the lack of explicit warnings about the irreversible nature of deletion, though this is somewhat implied. Overall, it's quite complete given the complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 2 parameters, the description provides comprehensive parameter information beyond what the schema offers. It explains the 'method' parameter's default value and purpose, details the 'params' structure including the required 'elementId' field with its data types, and provides a complete example showing proper usage. This fully compensates for the schema's lack of descriptions.

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 tool's purpose as '批量删除Revit元素' (batch delete Revit elements), which is a specific verb+resource combination. It distinguishes itself from sibling tools like 'find_elements', 'show_elements', 'move_elements', and 'update_elements' by focusing exclusively on deletion operations.

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. While it mentions supporting batch operations and JSON-RPC 2.0 compliance, it doesn't explain when deletion is appropriate versus other operations like updating or moving elements, nor does it mention any prerequisites or constraints for using this destructive operation.

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

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