move_elements
Move Revit elements in bulk by specifying distances in millimeters, with automatic unit conversion to feet and detailed feedback on moved elements.
Instructions
移动Revit元素,支持批量操作,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
支持批量移动多个Revit元素
自动处理单位转换(毫米转英尺)
返回移动后的元素详细信息(使用ElementModelRequest格式)
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"MoveElements" params (List[Dict]): 移动参数列表,每个字典包含: - elementId (str): 要移动的元素ID - x (float): X方向移动距离(毫米) - y (float): Y方向移动距离(毫米) - z (float): Z方向移动距离(毫米)
返回: 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 = move_elements(ctx, params=[ {"elementId": "123456", "x": 100, "y": 200, "z": 0}, {"elementId": "789012", "x": -50, "y": 0, "z": 300} ])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | MoveElements | |
| params | No |
Implementation Reference
- xml_revit_mcp/server.py:50-55 (registration)move_elements is included in GENERAL_TOOLS array, which lists functions to be registered as MCP tools.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 ]
- xml_revit_mcp/server.py:143-145 (registration)Loop that registers all functions in GENERAL_TOOLS, including move_elements, as MCP tools using server.tool() decorator.# 注册通用工具 for tool in GENERAL_TOOLS:
- xml_revit_mcp/server.py:16-16 (registration)Import statement that brings in move_elements and other tool functions from the .tools module.from .tools import *
- xml_revit_mcp/prompts.py:51-51 (helper)Prompt documentation instructing users to use move_elements() to adjust element positions.- 使用move_elements()调整元素位置