Revit MCP Server

by ZedMoster
Verified

call_func

Execute Revit functions by specifying names and parameters in JSON-RPC 2.0 format. Supports batch calls, parameter validation, and robust error handling to automate building model interactions.

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格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "elementId": "元素ID", "name": "元素名称", "familyName": "族名称" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }

示例: response = call_func(ctx, params=[ {"name": "ClearDuplicates"}, {"name": "DeleteZeroRooms"}, {"name": "DimensionViewPlanGrids"}, {"name": "新增标高", "params": {"offset": 3000}} ])

# 输出示例 { "jsonrpc": "2.0", "result": [ {"elementId": "123456", "name": "墙体", "familyName": "基本墙"}, {"elementId": "789012", "name": "房间", "familyName": "房间"}, {"elementId": "345678", "name": "尺寸标注", "familyName": "线性标注"}, {"elementId": "345672", "name": "标高 3", "familyName": "标高"}, ], "id": 1 }

Input Schema

NameRequiredDescriptionDefault
methodNoCallFunc
paramsNo

Input Schema (JSON Schema)

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