Revit MCP Server

by ZedMoster
Verified

execute_commands

Execute and manage Revit commands via JSON-RPC 2.0, enabling batch processing, toggling feature panels, and robust error handling for automated model interactions.

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

NameRequiredDescriptionDefault
methodNoExecuteCommands
paramsNo

Input Schema (JSON Schema)

{ "properties": { "method": { "default": "ExecuteCommands", "title": "Method", "type": "string" }, "params": { "default": null, "items": { "additionalProperties": true, "type": "object" }, "title": "Params", "type": "array" } }, "title": "execute_commandsArguments", "type": "object" }
ID: 4dgua6bhbf