Skip to main content
Glama
ZedMoster

Revit MCP Server

by ZedMoster

show_elements

Highlights and centers specified elements in Revit views for batch visualization, supporting both integer and string element IDs.

Instructions

在Revit视图中高亮显示指定元素,支持批量操作并遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量显示多个元素

  • 自动处理整数和字符串格式的元素ID

  • 元素自动缩放至视图中心并高亮显示

  • 严格的参数验证和错误处理

  • 完全匹配服务器端实现逻辑

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

返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [成功显示的元素ID列表], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": 错误代码, "message": 错误描述, "data": 错误详情 }, "id": request_id }

错误代码: -32600 (Invalid Request): 参数验证失败 -32602 (Invalid Params): 无效元素ID或元素不存在 -32603 (Internal Error): 内部处理错误 -32700 (Parse Error): 参数解析错误

示例: >>> # 显示多个元素 >>> response = show_elements(ctx, params=[ ... {"elementId": 212781}, ... {"elementId": "212792"} ... ]) >>> print(response) {"jsonrpc":"2.0","result":[212781,212792],"id":1}

视图操作: 成功调用后,元素将在当前视图中: 1. 自动缩放至视图中心 2. 高亮显示 3. 被添加到当前选择集

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoShowElements
paramsNo

Implementation Reference

  • show_elements is included in the GENERAL_TOOLS list used for registering MCP tools.
    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 from GENERAL_TOOLS (including show_elements) to the FastMCP server using server.tool() decorator.
    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 show_elements tool function from the .tools module.
    from .tools import *
  • Test script demonstrating the RPC method 'ShowElements' corresponding to the MCP tool 'show_elements'.
    "method": "ShowElements",
  • Documentation mentioning usage of show_elements tool.
    - 使用show_elements()在视图中高亮显示特定元素
Behavior5/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. It discloses multiple behavioral traits: batch operation support, automatic handling of ID formats, automatic zooming to center, highlighting, adding to selection set, strict parameter validation, error handling, and JSON-RPC 2.0 compliance. This goes well beyond basic functionality disclosure.

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-loads the core purpose. Some sections could be more concise (e.g., the JSON-RPC format details are quite verbose), but overall it's efficiently organized with each section earning its place.

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?

For a tool with no annotations, no output schema, and 0% schema description coverage, the description provides exceptional completeness. It covers purpose, usage, parameters, return format, error codes, examples, and post-execution visual effects. The only minor gap is lack of explicit prerequisites, but given the context, this is complete enough.

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. It explains both parameters: 'method' (JSON-RPC method name, default 'ShowElements') and 'params' (list of dictionaries with elementId). It provides detailed structure requirements, data types, and examples. This adds substantial meaning beyond the bare schema.

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视图中高亮显示指定元素' (highlight specified elements in Revit view). It specifies the verb (highlight/display) and resource (elements in Revit view), and distinguishes from siblings like 'find_elements' (search) or 'get_selected_elements' (retrieve).

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: for highlighting elements in Revit views, supporting batch operations. It doesn't explicitly state when NOT to use it or name alternatives, but the context is sufficiently clear given the sibling tools are mostly creation/update/retrieval tools rather than visualization tools.

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