Skip to main content
Glama

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
NameRequiredDescriptionDefault
categoryIdNo族类别 ID(可选)
nameNo族名称过滤(可选)

Implementation Reference

  • 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;
    }
  • 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;
      }
    }
  • 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: "族名称过滤(可选)"
          }
        }
      }
    }, {
  • 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: "族名称过滤(可选)"
        }
      }
    }

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/PiggyAndrew/revit_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server