Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

get_locations

Retrieve 3D coordinates of Revit elements in millimeters for points and curves, supporting batch queries with automatic unit conversion from feet.

Instructions

获取Revit元素的位置信息,支持点和曲线元素,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量查询多个元素的位置

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

  • 支持点位置和曲线位置(直线和圆弧)

  • 完善的错误处理机制

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"GetLocations" params (List[Dict]): 查询参数列表,每个字典包含: - elementId (Union[str, int]): 要查询的元素ID,优先使用str类型Id

返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": { "elementId1": [ { "X": float, # X坐标(毫米) "Y": float, # Y坐标(毫米) "Z": float # Z坐标(毫米) }, ... ], ... }, "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }

错误代码: -32600: 无效请求 -32602: 无效参数(元素不存在等) -32603: 内部错误 -32700: 解析错误

示例: # 查询多个元素的位置 response = get_location(ctx, params=[ {"elementId": 123456}, {"elementId": "789012"} ])

# 输出示例(XYZ元素)
{
    "jsonrpc": "2.0",
    "result": {
        "123456": [
            {"X": 1000.0, "Y": 2000.0, "Z": 0.0}
        ]
    },
    "id": 1
}

# 输出示例(Line元素)
{
    "jsonrpc": "2.0",
    "result": {
        "789012": [
            {"X": 0.0, "Y": 0.0, "Z": 0.0},
            {"X": 5000.0, "Y": 0.0, "Z": 0.0}
        ]
    },
    "id": 1
}
# 输出示例(Arc元素)
{
    "jsonrpc": "2.0",
    "result": {
        "789012": [
            {"X": 0.0, "Y": 0.0, "Z": 0.0},
            {"X": 5000.0, "Y": 0.0, "Z": 0.0}
            {"X": 2500.0, "Y": 1200, "Z": 0.0}
        ]
    },
    "id": 1
}

用途:找到定位后可用于创建门窗这种带有主体的族,族插入点就可以通过这个计算出来

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoGetLocations
paramsNo

Implementation Reference

  • get_locations is listed in the GENERAL_TOOLS array, indicating it is one of the general tools registered with the MCP server.
    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
    ]
  • The register_tools function registers all tools in GENERAL_TOOLS, including get_locations, by calling server.tool()(tool). This is invoked at line 248.
    # 注册通用工具
    for tool in GENERAL_TOOLS:
        server.tool()(tool)
  • Imports all tools from .tools module, which likely defines get_locations and other tool functions.
    from .tools import *
  • Test file demonstrating usage of GetLocations RPC method via TCP, suggesting the tool forwards to Revit RPC.
    send_tcp_data(json_rpc_request)
  • Mentions usage of get_locations() in asset creation strategy prompt.
    - 使用get_locations()获取墙体的位置信息,以便正确放置门窗
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 an excellent job disclosing behavioral traits. It describes: batch query capability ('支持批量查询多个元素的位置'), automatic unit conversion ('自动处理单位转换(英尺转毫米)'), support for different element types ('支持点位置和曲线位置(直线和圆弧)'), error handling ('完善的错误处理机制'), and JSON-RPC 2.0 compliance. It also provides detailed error codes and response structures, giving the agent comprehensive behavioral understanding.

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 and not optimally structured. While it contains valuable information, it mixes implementation details ('mcp_tool使用时params不要有任何注释信息'), technical specifications, examples, and usage guidance without clear sectioning. The information is useful but could be more efficiently organized and front-loaded with the core purpose and key parameters.

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 the tool (JSON-RPC interface, batch processing, unit conversion, multiple element types) and the absence of both annotations and output schema, the description provides exceptional completeness. It covers purpose, parameters, return values, error handling, examples, and even practical applications. The agent has all necessary context to understand and correctly invoke this tool despite the lack of structured metadata.

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 providing detailed parameter semantics. It explains: 'ctx (Context): FastMCP上下文对象', 'method (str): JSON-RPC方法名,默认为"GetLocations"', and most importantly, details the complex 'params' parameter structure with 'elementId' field requirements and type preferences. The description adds substantial meaning beyond what the bare schema provides, including examples of parameter usage.

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元素的位置信息,支持点和曲线元素' (Get location information for Revit elements, supporting point and curve elements). It specifies the resource (Revit elements) and action (get location information), and distinguishes from siblings like 'find_elements' or 'get_view_data' by focusing specifically on location data extraction.

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 some usage context at the end ('用途:找到定位后可用于创建门窗这种带有主体的族,族插入点就可以通过这个计算出来' - Purpose: After finding locations, it can be used to create families with hosts like doors/windows, family insertion points can be calculated from this). However, it doesn't explicitly state when to use this tool versus alternatives like 'find_elements' or 'get_selected_elements', nor does it provide clear exclusion criteria or prerequisites for usage.

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