get_families
Retrieve all families from a Revit model, with optional filtering by category or name to find specific components.
Instructions
获取 Revit 模型中的所有族
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categoryId | No | 族类别 ID(可选) | |
| name | No | 族名称过滤(可选) |
Implementation Reference
- src/revitSocketClient.ts:227-230 (handler)Core implementation of the get_families tool: sends the 'get_families' command with empty arguments to the Revit socket server via sendRequest.public async getFamilies(): Promise<any[]> { const response = await this.sendRequest<any[]>('get_families', {}); return response; }
- src/revitService.ts:124-131 (helper)Helper method in RevitService that delegates getFamilies call to the RevitSocketClient instance.async getFamilies(): Promise<any[]> { try { return await this.client.getFamilies(); } catch (error) { console.error('[RevitService] 获取族失败:', error); throw error; } }
- src/index.ts:205-221 (handler)Dynamic handler in MCP CallToolRequestSchema that converts tool name 'get_families' to 'getFamilies' and invokes it on RevitService with arguments.const toolName = request.params.name; // 将工具名称转换为 camelCase 方法名 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 = '';
- src/index.ts:124-139 (registration)Registration of the 'get_families' tool in the MCP ListToolsRequestSchema response, including description and input schema (note: arguments not passed to implementation).name: "get_families", description: "获取 Revit 模型中的所有族", inputSchema: { type: "object", properties: { categoryId: { type: "string", description: "族类别 ID(可选)" }, name: { type: "string", description: "族名称过滤(可选)" } } } }, {
- src/index.ts:126-138 (schema)Input schema definition for the get_families tool, specifying optional categoryId and name parameters.inputSchema: { type: "object", properties: { categoryId: { type: "string", description: "族类别 ID(可选)" }, name: { type: "string", description: "族名称过滤(可选)" } } }