Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

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)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it supports batch operations, automatically validates level element validity, uses transactional operations for data consistency, has comprehensive error handling, and notes specific behaviors like not creating rooms on levels without enclosed areas (without error). It also details the JSON-RPC 2.0 compliance and error codes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (特性, 参数, 返回, 错误代码, 示例, 注意) and front-loaded purpose statement. While comprehensive, some sections like the detailed JSON-RPC response structure could be slightly condensed, but overall it's efficient with minimal redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a creation tool with no annotations and no output schema, the description is remarkably complete. It covers purpose, parameters, return format (including both success and error responses), error codes, examples, and important behavioral notes. This provides sufficient context for an AI agent to understand and use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 2 parameters, the description fully compensates by explaining both parameters in detail: 'method' is described as the JSON-RPC method name defaulting to 'CreateRooms', and 'params' is explained as a list of dictionaries containing 'elementId' for level identification. It provides format examples and clarifies that 'ctx' is a FastMCP context object.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '在指定标高上创建房间' (create rooms on specified levels/elevations). It specifies the verb ('创建' - create) and resource ('房间' - rooms), and distinguishes it from siblings like create_floors, create_walls, and create_room_tags by focusing on room creation specifically on levels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context through the example and notes, showing it's for creating rooms on levels with enclosed areas. However, it doesn't explicitly state when to use this versus alternatives like create_family_instances or create_room_tags, nor does it mention prerequisites or exclusions beyond the note about levels without enclosed areas.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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