Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

update_elements

Batch update parameter values for Revit elements with automatic type conversion, detailed error reporting, and transaction support.

Instructions

批量更新Revit元素参数值,遵循JSON-RPC 2.0规范,支持事务处理。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持混合格式元素ID(整数/字符串)

  • 自动参数值类型转换

  • 详细的错误报告和元素级状态跟踪

  • 严格遵循JSON-RPC 2.0规范

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"UpdateElements" params (List[Dict[str, Union[str, int]]]): 更新参数列表,每个字典必须包含: - elementId (Union[str, int]): 要更新的元素ID - parameterName (str): 参数名称(区分大小写) - parameterValue (str): 参数新值

返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "elementId": "元素ID", "name": "元素名称", "familyName": "族名称" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": 错误代码, "message": 错误描述, "data": 错误详情 }, "id": request_id }

错误代码: -32600 (Invalid Request): 参数验证失败 -32602 (Invalid Params): 无效参数(元素不存在/参数不存在等) -32603 (Internal Error): 内部处理错误 -32700 (Parse Error): 参数解析错误

示例: > # 批量更新元素参数 > response = update_elements(ctx, params=[ ... {"elementId": 123456, "parameterName": "Comments", "parameterValue": "Test"}, ... {"elementId": "789012", "parameterName": "Height", "parameterValue": "3000"} ... ]) > print(response) { "jsonrpc": "2.0", "result": [ {"elementId": "123456", "name": "基本墙", "familyName": "基本墙"}, {"elementId": "789012", "name": "单扇门", "familyName": "M_单扇门"} ], "id": 1 }

# 错误情况示例
> response = update_elements(ctx, params=[
...     {"elementId":112,"parameterName":"InvalidParam","parameterValue":"X"} ])
> print(response)
> {"jsonrpc":"2.0","error":{"code":-32602,"message":"参数无效","data":"参数'InvalidParam'不存在"},"id":1}

事务说明: 所有更新操作在Revit事务组中执行,任一更新失败自动跳过。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoUpdateElements
paramsNo

Implementation Reference

  • Registration of the update_elements tool as part of GENERAL_TOOLS using the FastMCP server.tool() decorator in the register_tools function.
    # 注册通用工具
    for tool in GENERAL_TOOLS:
        server.tool()(tool)
  • update_elements is listed in the GENERAL_TOOLS array which is used for registration.
    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
    ]
  • Example input schema for the tool: list of dicts with elementId (int or str), parameterName (str), parameterValue (str). Used with RPC method 'UpdateElements'.
    data = [
        {"elementId": 212781, "parameterName": "注释", "parameterValue": "2100"},
        {"elementId": "212792", "parameterName": "注释", "parameterValue": "test"}
    ]
    
    # 构造 JSON-RPC 请求
    json_rpc_request = {
        "jsonrpc": "2.0",
        "method": "UpdateElements",
        "params": data,
    }
    
    # 发送更新元素数据
    send_tcp_data(json_rpc_request)
  • Documentation mentioning usage of update_elements to modify element parameters after getting them with parameter_elements.
    - 使用parameter_elements()获取元素参数,然后使用update_elements()修改
Behavior5/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 excels by detailing key behavioral traits: '支持事务处理' (supports transaction processing), '自动参数值类型转换' (automatic parameter value type conversion), '详细的错误报告和元素级状态跟踪' (detailed error reporting and element-level status tracking), '严格遵循JSON-RPC 2.0规范' (strictly follows JSON-RPC 2.0 specification), and '所有更新操作在Revit事务组中执行,任一更新失败自动跳过' (all update operations execute in Revit transaction group; any update failure is automatically skipped). This provides comprehensive insight into the tool's behavior beyond basic functionality.

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 sections like '特性' (features), '参数' (parameters), '返回' (return), '错误代码' (error codes), '示例' (examples), and '事务说明' (transaction explanation). However, it is verbose at approximately 500 words, with some redundancy (e.g., repeating JSON-RPC 2.0 specification). The front-loading is moderate—core purpose is stated early, but details could be more streamlined. Every sentence adds value, but efficiency could be improved.

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

Completeness5/5

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

Given the tool's complexity (batch updates with transactions, JSON-RPC), no annotations, 0% schema coverage, and no output schema, the description provides exceptional completeness. It covers purpose, features, parameters with semantics, return format (including success/failure structures), error codes, examples, and transaction behavior. This compensates fully for the lack of structured data, making the tool understandable and actionable for an AI agent.

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?

Schema description coverage is 0%, so the description must compensate. It does so thoroughly by explaining all parameters: 'ctx (Context): FastMCP上下文对象' (FastMCP context object), 'method (str): JSON-RPC方法名,默认为"UpdateElements"' (JSON-RPC method name, defaults to "UpdateElements"), and details for 'params' including required fields (elementId, parameterName, parameterValue) with types and constraints. This adds significant meaning beyond the minimal input schema, fully documenting the 2 parameters (context signals indicate 2 parameters, though description lists 3—ctx, method, params—but ctx is likely implicit).

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: '批量更新Revit元素参数值' (batch update Revit element parameter values). It specifies the verb '更新' (update) and resource 'Revit元素参数值' (Revit element parameter values), distinguishing it from sibling tools like delete_elements, move_elements, or parameter_elements. The title is null, so the description fully defines the tool's function.

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

Usage Guidelines3/5

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

The description implies usage context through '批量更新' (batch update) and '遵循JSON-RPC 2.0规范' (follows JSON-RPC 2.0 specification), suggesting it's for batch operations within a JSON-RPC framework. However, it lacks explicit guidance on when to use this tool versus alternatives like parameter_elements or move_elements, or any prerequisites. The '事务说明' (transaction explanation) section provides some operational context but not comparative guidance.

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