Skip to main content
Glama

execute_commands

Execute commands to add or remove Revit functionality panels in batch, with automatic matching and error handling for building model automation.

Instructions

执行指定的功能命令,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息

特性:

  • 支持批量执行多个功能命令

  • 可以指定是添加还是移除功能面板

  • 自动查找并执行匹配名称的功能

  • 完善的错误处理机制

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"ExecuteCommands" params (List[Dict]): 命令参数列表,每个字典包含: - name (str): 要执行的功能名称 - add (bool): True表示添加功能面板,False表示移除功能面板

返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "name": "AI助手", "description": "使用DeepSeek直接操作Revit,会员用户抢先体验", "tooltip": "关注公众号获取最新功能消息(F1获取帮助)" }, { "name": "AI代码转换", "description": "AI生成的代码功能尝试转换为Revit可用功能,会员用户抢先体验~", "tooltip": "关注公众号获取最新功能消息(F1获取帮助)" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }

示例: # 添加功能面板 response = execute_command(ctx, params=[ {"name": "AI助手", "add": True}, {"name": "AI代码转换", "add": True} ])

# 移除功能面板 response = execute_command(ctx, params=[ {"name": "AI助手", "add": False} ])

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoExecuteCommands
paramsNo

Implementation Reference

  • The 'execute_commands' tool is listed in GENERAL_TOOLS array, which is registered to the MCP server using server.tool() in the register_tools function called at line 248.
    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 ]
  • Registration loop for general tools including execute_commands using FastMCP's tool decorator.
    # 注册通用工具 for tool in GENERAL_TOOLS: server.tool()(tool)
  • Test file demonstrating usage of ExecuteCommands RPC method sent to Revit plugin, likely corresponding to the MCP tool execution.
    # -*- coding: utf-8 -*- from _tcp import send_tcp_data # 构造 JSON-RPC 请求 json_rpc_request = { "jsonrpc": "2.0", "method": "ExecuteCommands", "params": [ {"name": "F1关闭启用", "add": True}, {"name": "F1关闭启用", "add": False} ] , } # 发送更新元素数据 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