get_commands
Retrieve a complete list of all available features in Revit plugins, including their names, descriptions, and tooltips, using JSON-RPC 2.0. No additional parameters required.
Instructions
获取所有功能商店里的功能,每个功能包含名称、描述和提示信息,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
获取Revit插件中所有可用功能的完整列表
返回每个功能的名称、描述和提示信息
无需额外参数,直接获取所有功能
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"GetCommands"
返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "name": "功能名称", "description": "功能描述", "tooltip": "功能提示" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }
示例: # 获取所有功能 response = get_commands(ctx)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | GetCommands |
Implementation Reference
- xml_revit_mcp/server.py:50-55 (registration)get_commands is included in the GENERAL_TOOLS list, defining the set of general MCP tools including get_commands.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 ]
- xml_revit_mcp/server.py:144-147 (registration)The register_tools function registers all tools from GENERAL_TOOLS (including get_commands) to the MCP server using server.tool() decorator.# 注册通用工具 for tool in GENERAL_TOOLS: server.tool()(tool)
- xml_revit_mcp/server.py:212-245 (helper)list_tools function inspects and lists information about all registered tools including get_commands, providing schema-like info via inspect.# 获取通用工具信息 for tool in GENERAL_TOOLS: sig = inspect.signature(tool) params = [] for param_name, param in sig.parameters.items(): if param_name != 'ctx': param_info = { "name": param_name, "required": param.default == inspect.Parameter.empty, "default": None if param.default == inspect.Parameter.empty else param.default } params.append(param_info) doc = inspect.getdoc(tool) description = doc.split('\n')[0] if doc else "无描述" tool_info = { "name": tool.__name__, "description": description, "full_doc": doc, "parameters": params } tools_info["general"].append(tool_info) # 添加所有工具的汇总列表 all_tools = [] all_tools.extend(tools_info["architectural"]) all_tools.extend(tools_info["mep"]) all_tools.extend(tools_info["general"]) tools_info["all"] = all_tools logger.info(f"获取到 {len(all_tools)} 个工具函数") return tools_info
- xml_revit_mcp/prompts.py:16-17 (helper)Prompt documentation instructs to use get_commands() to get all available functions.- 使用get_commands()获取所有可用功能 - 使用get_selected_elements()检查当前选中的元素