Revit MCP Server

by ZedMoster
Verified

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

NameRequiredDescriptionDefault
methodNoShowElements
paramsNo

Input Schema (JSON Schema)

{ "properties": { "method": { "default": "ShowElements", "title": "Method", "type": "string" }, "params": { "default": null, "items": { "additionalProperties": true, "type": "object" }, "title": "Params", "type": "array" } }, "title": "show_elementsArguments", "type": "object" }
ID: 4dgua6bhbf