parameter_elements
Retrieve detailed parameter information for Revit elements in bulk or for specific parameters using the JSON-RPC 2.0 protocol. Supports error handling and returns parameter hash codes, names, and values.
Instructions
获取Revit元素的参数信息,支持批量查询和特定参数查询,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
支持批量查询多个元素的参数
可查询特定参数或元素所有参数
返回参数哈希码、名称和值的完整信息
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"ParameterElements" params (List[Dict]): 查询参数列表,每个字典包含: - elementId (Union[int, str]): 要查询的元素ID - parameterName (str, optional): 要查询的特定参数名称
返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": { "elementId1": [ { "hashCode": int, "parameterName": str, "parameterValue": str, } ], ... }, "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }
示例: # 查询多个元素的参数 response = parameter_elements(ctx, params=[ {"elementId": 212792, "parameterName": "注释"}, # 获取特定参数 {"elementId": 212781} # 获取所有参数 ])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | ParameterElements | |
| params | No |
Implementation Reference
- xml_revit_mcp/server.py:50-55 (registration)Registration list for general tools including the parameter_elements tool function.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:144-147 (registration)Code that registers all tools from GENERAL_TOOLS (including parameter_elements) to the FastMCP server using the @tool decorator.# 注册通用工具 for tool in GENERAL_TOOLS: server.tool()(tool)
- tests/ParameterElements.py:6-16 (schema)Example/test showing the input schema for parameter_elements: list of dicts each with 'elementId' (required) and optional 'parameterName'.data = [ {"elementId": 212792, "parameterName": "注释", }, {"elementId": 212781, }, ] # 构造 JSON-RPC 请求 json_rpc_request = { "jsonrpc": "2.0", "method": "ParameterElements", "params": data, }
- xml_revit_mcp/prompts.py:50-52 (helper)Documentation in prompt describing usage of parameter_elements tool to retrieve element parameters.- 使用parameter_elements()获取元素参数,然后使用update_elements()修改 - 使用move_elements()调整元素位置 - 使用show_elements()在视图中高亮显示特定元素
- xml_revit_mcp/server.py:71-71 (helper)No exact handler function found for parameter_elements; likely a thin wrapper around RevitConnection.send_command("parameter_elements", params) imported from .tools.try: