Skip to main content
Glama

create_rooms

Create rooms on specified levels in Revit models. Batch generate rooms across multiple levels with automatic validation and transactional consistency.

Instructions

在指定标高上创建房间,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量在多个标高上创建房间

  • 自动验证标高元素有效性

  • 事务化操作确保数据一致性

  • 完善的错误处理机制

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

返回: 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 }

错误代码: -32600: 无效请求 -32602: 无效参数(元素不是标高或无效) -32603: 内部错误 -32700: 解析错误

示例: # 在多个标高上创建房间 response = create_rooms(ctx, params=[ {"elementId": 123456}, {"elementId": "789012"} ])

# 输出示例 { "jsonrpc": "2.0", "result": [ { "elementId": "212801", "name": "房间 1", "familyName": "房间" }, { "elementId": "212802", "name": "房间 2", "familyName": "房间" } ], "id": 1 }

注意: 1. 会在指定标高的所有封闭区域创建房间 2. 返回的房间信息列表顺序与创建顺序一致 3. 如果标高没有封闭区域,则不会创建房间但也不会报错

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoCreateRooms
paramsNo

Implementation Reference

  • create_rooms is included in the ARCHITECTURAL_TOOLS list used for tool registration
    ARCHITECTURAL_TOOLS = [ create_levels, create_floor_plan_views, create_grids, create_walls, create_floors, create_door_windows, create_rooms, create_room_tags, create_family_instances, create_sheets ]
  • register_tools function loops over tool lists including ARCHITECTURAL_TOOLS containing create_rooms and registers each with server.tool()
    def register_tools(server: FastMCP) -> None: """注册所有工具到MCP服务器""" # 注册建筑工具 for tool in ARCHITECTURAL_TOOLS: server.tool()(tool) # 注册MEP工具 for tool in MEP_TOOLS: server.tool()(tool) # 注册通用工具 for tool in GENERAL_TOOLS: server.tool()(tool)
  • Import statement that brings in the create_rooms handler function from the tools module
    from .tools import *
  • Prompt documentation referencing create_rooms usage for creating rooms in enclosed areas
    - 使用create_rooms()在封闭区域创建房间
  • Test script sending JSON-RPC request with method 'CreateRooms' demonstrating the underlying Revit RPC call proxied by the MCP tool
    # 构造 JSON-RPC 请求 json_rpc_request = { "jsonrpc": "2.0", "method": "CreateRooms", "params": data, } # 发送更新元素数据 send_tcp_data(json_rpc_request)

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