Skip to main content
Glama

get_levels

Extract all floor levels from a Revit model for efficient analysis and project management using the Revit MCP Server.

Instructions

获取 Revit 模型中的所有楼层

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get_levels' MCP tool. Delegates the execution to the underlying Revit socket client to fetch levels.
    async getLevels(): Promise<any[]> { try { return await this.client.getLevels(); } catch (error) { console.error('[RevitService] 获取楼层失败,使用模拟数据:', error); throw error; // 不使用模拟数据,直接抛出错误 } }
  • Low-level helper function that sends the 'get_levels' RPC request over the socket to the Revit server.
    public async getLevels(sortByElevation: boolean = true): Promise<any[]> { const response = await this.sendRequest<any[]>('get_levels', { }); return response;
  • Schema definition for the 'get_levels' tool used in tool discovery (ListTools response), specifying name, description, and empty input schema.
    name: "get_levels", description: "获取 Revit 模型中的所有楼层", inputSchema: { type: "object", properties: {} } }, {
  • src/index.ts:201-238 (registration)
    Registers the CallToolRequestSchema handler, which dynamically maps tool name 'get_levels' to revitService.getLevels() execution.
    this.server.setRequestHandler( CallToolRequestSchema, async (request) => { // 获取工具名称 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 = ''; return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Revit API 错误: ${error instanceof Error ? error.message : String(error)}` }], isError: true, } } } );

Other Tools

Related Tools

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