Skip to main content
Glama

call_func

Execute Revit functions by specifying names and parameters in JSON-RPC format, enabling automation of building model operations through batch processing with parameter validation.

Instructions

调用 Revit 函数服务,支持直接传递功能名称及其参数,遵循 JSON-RPC 2.0 规范。

特性:

  • 支持批量调用多个功能

  • 支持传递参数给每个功能

  • 自动验证参数有效性

  • 完善的错误处理机制

参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CallFunc" params (List[Dict]): 功能参数列表,必须提供至少一个函数名,每个字典包含: - name (str): 要调用的功能名称 - params (dict, optional): 功能对应的参数,可为空

返回: dict: JSON-RPC 2.0格式的响应

示例: # 调用不需要参数的函数 response = call_func(ctx, params=[ {"name": "ClearDuplicates"}, {"name": "DimensionViewPlanGrids"}, {"name": "DeleteZeroRooms"} ])

# 调用带参数的函数 response = call_func(ctx, params=[ {"name": "新增标高", "params": {"offset": 3000}} ]) # 混合调用 response = call_func(ctx, params=[ {"name": "ClearDuplicates"}, {"name": "新增标高", "params": {"offset": 3000}} ])

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoCallFunc
paramsNo

Implementation Reference

  • call_func is included in the GENERAL_TOOLS list, indicating it is one of the general tools to be registered as an MCP tool.
    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 call_func) to the MCP server using the 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)
  • Prompt template mentions using call_func() to call specific functions not predefined.
    - 对于未预定义的功能,使用call_func()调用特定功能
  • Test file demonstrates calling the underlying Revit RPC method 'CallFunc', likely what the MCP tool proxies.
    "method": "CallFunc", "params": data, }

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