Skip to main content
Glama

show_elements

Highlight and center specified elements in Revit views using JSON-RPC 2.0. Supports batch operations, auto-scaling, strict parameter validation, and detailed error handling for precise element visualization.

Instructions

在Revit视图中高亮显示指定元素,支持批量操作并遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量显示多个元素

  • 自动处理整数和字符串格式的元素ID

  • 元素自动缩放至视图中心并高亮显示

  • 严格的参数验证和错误处理

  • 完全匹配服务器端实现逻辑

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

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

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

示例: >>> # 显示多个元素 >>> response = show_elements(ctx, params=[ ... {"elementId": 212781}, ... {"elementId": "212792"} ... ]) >>> print(response) {"jsonrpc":"2.0","result":[212781,212792],"id":1}

视图操作: 成功调用后,元素将在当前视图中: 1. 自动缩放至视图中心 2. 高亮显示 3. 被添加到当前选择集

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoShowElements
paramsNo

Implementation Reference

  • show_elements is registered as part of GENERAL_TOOLS list, which are then registered using server.tool() in register_tools function called at line 248.
    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 ]
  • Test file demonstrating usage of ShowElements RPC method with element IDs.
    "method": "ShowElements", "params": data, } # 发送更新元素数据 send_tcp_data(json_rpc_request)
  • Documentation mentioning usage of show_elements() to highlight elements in view.
    - 使用show_elements()在视图中高亮显示特定元素
  • Documentation mentioning using show_elements() to check key elements.
    - 使用show_elements()检查关键元素
  • The loop that applies server.tool() decorator to all tools in GENERAL_TOOLS including show_elements.
    for tool in GENERAL_TOOLS: server.tool()(tool)

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