Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

create_family_instances

Create and place Revit family instances in bulk using various placement methods like levels, views, or curves, with automatic unit conversion and type matching.

Instructions

在Revit中创建族实例,支持多种放置方式,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量创建多个族实例

  • 自动处理单位转换(毫米转英尺)

  • 支持多种放置类型:

    • 基于标高放置

    • 基于视图放置

    • 基于工作平面放置

    • 基于宿主放置

    • 基于曲线放置

  • 支持旋转和偏移

  • 自动匹配族类型和类别

  • 完善的错误处理机制

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CreateFamilyInstances" params (List[Dict]): 族实例参数列表,每个字典包含: - categoryName (str): 支持按类别BuiltInCategory或者Category.Name查找(如"OST_Walls","OST_Doors", "墙", "门", "结构框架"等) - name (str): 族类型名称 - startX (float): 起点X坐标(毫米) - startY (float): 起点Y坐标(毫米) - startZ (float): 起点Z坐标(毫米) - familyName (str, optional): 族名称(可选,用于更精确匹配) - endX (float, optional): 终点X坐标(毫米,默认等于startX) - endY (float, optional): 终点Y坐标(毫米,默认等于startY) - endZ (float, optional): 终点Z坐标(毫米,默认等于startZ) - hostId (str, optional): 宿主元素ID(可选) - viewName (str, optional): 视图名称(可选) - rotationAngle (float, optional): 旋转角度(度,默认0) - offset (float, optional): 偏移距离(毫米,默认0)

返回: 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 = create_family_instances(ctx, params=[ # 基于标高的门 { "categoryName": "窗", "name": "0406 x 0610mm", "startX": 1000, "startY": 2000, "startZ": 0, "hostId": 225535, "level": "标高 1", }, # 基于视图的家具 { "categoryName": "OST_Furniture", "name": "办公桌", "startX": 3000, "startY": 4000, "startZ": 0, "viewName": "标高 1", "rotationAngle": 90 }, # 基于曲线的梁 { "categoryName": "OST_StructuralFraming", "name": "H型钢梁", "startX": 0, "startY": 0, "startZ": 3000, "endX": 5000, "endY": 0, "endZ": 3000 } ])

# 输出示例
{
    "jsonrpc": "2.0",
    "result": [213101, 213102, 213103],
    "id": 1
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoCreateFamilyInstances
paramsNo

Implementation Reference

  • The tool create_family_instances is declared in the ARCHITECTURAL_TOOLS list used for registering architectural tools to the MCP server.
    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
    ]
  • Registration loop that applies the MCP server.tool() decorator to create_family_instances and other architectural tools.
    # 注册建筑工具
    for tool in ARCHITECTURAL_TOOLS:
        server.tool()(tool)
  • Usage guidance in asset_creation_strategy prompt recommending create_family_instances for parameterized family instances.
    3. 创建复杂组件时:
       - 使用create_family_instances()创建参数化族实例
       - 对于未预定义的功能,使用call_func()调用特定功能
  • Example input parameters structure for CreateFamilyInstances method, likely corresponding to the create_family_instances tool parameters.
    data = [
        {
            "categoryName": "场地",  # 族实例的类别
            "name": "12000 x 2400mm",  # 族类型名称
            "familyName": "建筑拖车",  # 族名称(可选)
            "startX": 1000,  # 起始位置X(单位:mm)
            "startY": 2000,  # 起始位置Y(单位:mm)
            "startZ": 0,  # 起始位置Z(单位:mm)
            "viewName": "标高 1",  # 视图名称(可选)
            "rotationAngle": 0  # 旋转角度(单位:度,可选)
        },
        {
            "categoryName": "场地",  # 族实例的类别
            "name": "12000 x 2400mm",  # 族类型名称
            "familyName": "建筑拖车",  # 族名称(可选)
            "startX": 5000,  # 起始位置X(单位:mm)
            "startY": 2000,  # 起始位置Y(单位:mm)
            "startZ": 3300,  # 起始位置Z(单位:mm)
            "rotationAngle": 45  # 旋转角度(单位:度,可选)
        },
        {
            "categoryName": "窗",
            "name": "0406 x 0610mm",
            "startX": -10500,
            "startY": 5000,
            "startZ": 0, 
            "hostid": 225535,
            "level": "标高 1",
        },
        {
            "categoryName": "柱",
            "name": "610 x 610mm",
            "startX": -10500,
            "startY": 5000,
            "startZ": 4000,
            "level": "标高 1",
            "rotationAngle": 45
        },
        {
            "categoryName": "柱",
            "name": "610 x 610mm",
            "startX": -10500,
            "startY": 5000,
            "startZ": 0,
            "level": "标高 2",
            "rotationAngle": 0
        },
        {
            "categoryName": "结构框架",
            "name": "HW400x400x13x21",
            "startX": -10500,
            "startY": -5000,
            "startZ": 4000,
            "endX": -4500,
            "endY": 4500,
            "endZ": 5500,
            "rotationAngle": 0
        }
    ]
    
    # 构造 JSON-RPC 请求
    json_rpc_request = {
        "jsonrpc": "2.0",
        "method": "CreateFamilyInstances",
        "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 multiple behavioral traits: batch creation capability, automatic unit conversion (millimeters to feet), multiple placement types, rotation/offset support, automatic family type/category matching, and comprehensive error handling. It also mentions JSON-RPC 2.0 compliance. However, it doesn't cover permission requirements or rate limits.

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

Conciseness3/5

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

The description is comprehensive but lengthy with multiple sections (features, parameters, returns, examples). While well-structured, it could be more front-loaded; the core purpose appears early, but detailed features and parameters follow. Some sentences like 'mcp_tool使用时params不要有任何注释信息' seem out of place and don't add value for AI tool selection.

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

Completeness4/5

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

For a complex creation tool with 2 parameters (but nested complexity), 0% schema coverage, no annotations, and no output schema, the description provides substantial context: detailed parameter semantics, return format specification, and comprehensive examples. It covers most needs but could benefit from more explicit guidance on when to use versus sibling creation tools.

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 (schema only shows 'method' and 'params' as generic objects), the description provides extensive parameter documentation: it explains the two main parameters (ctx and method), details 13 specific fields within the params array with descriptions, units, optionality, and examples. This fully compensates for the schema's lack of detail.

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: '在Revit中创建族实例' (create family instances in Revit). It specifies the action (create) and resource (family instances), distinguishing it from sibling tools like create_walls or create_floors that create specific element types rather than generic family instances.

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 implies usage through the feature list (e.g., '支持批量创建多个族实例' - supports batch creation of multiple family instances) and parameter examples, but doesn't explicitly state when to use this tool versus alternatives like create_door_windows or create_walls. It provides context about placement types but lacks explicit guidance on tool selection.

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