get_families
Extract all families from a Revit model, optionally filtered by category ID or family name, using the Revit MCP Server for efficient model data retrieval.
Instructions
获取 Revit 模型中的所有族
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categoryId | No | 族类别 ID(可选) | |
| name | No | 族名称过滤(可选) |
Implementation Reference
- src/revitSocketClient.ts:227-230 (handler)Core handler function that executes the tool logic by sending the 'get_families' command to the Revit socket server and returning the response.public async getFamilies(): Promise<any[]> { const response = await this.sendRequest<any[]>('get_families', {}); return response; }
- src/revitService.ts:124-131 (handler)Intermediate handler in RevitService that delegates to socket client and provides error handling for the get_families tool.async getFamilies(): Promise<any[]> { try { return await this.client.getFamilies(); } catch (error) { console.error('[RevitService] 获取族失败:', error); throw error; } }
- src/index.ts:124-139 (registration)Registers the 'get_families' tool in the MCP ListTools response, including description and input schema definition.name: "get_families", description: "获取 Revit 模型中的所有族", inputSchema: { type: "object", properties: { categoryId: { type: "string", description: "族类别 ID(可选)" }, name: { type: "string", description: "族名称过滤(可选)" } } } }, {
- src/index.ts:208-221 (handler)Dynamic tool dispatching logic in MCP CallToolRequestSchema handler that maps 'get_families' to RevitService.getFamilies() and executes it.const methodName = toolName.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()); // 检查 RevitService 是否有对应的方法 if (typeof (this.revitService as any)[methodName] !== 'function') { throw new McpError( ErrorCode.MethodNotFound, `未知工具: ${toolName}` ); } try { // 动态调用对应的方法 const result = await (this.revitService as any)[methodName](request.params.arguments || {}); //const result = '';