get_views
Extract and retrieve all views from a Revit model using the MCP server, enabling easy access to view information for analysis or export.
Instructions
获取 Revit 模型中的所有视图
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/revitService.ts:100-107 (handler)The handler function in RevitService that executes the core logic for the 'get_views' MCP tool by delegating to the socket client.async getViews(): Promise<any[]> { try { return await this.client.getViews(); } catch (error) { console.error('[RevitService] 获取视图失败:', error); throw error; // 不使用模拟数据,直接抛出错误 } }
- src/revitSocketClient.ts:219-222 (handler)Socket client implementation of getViews that sends the 'get_views' command to the Revit plugin and awaits the response.public async getViews(): Promise<any[]> { const response = await this.sendRequest<any[]>('get_views', {}); return response; }
- src/index.ts:168-174 (schema)Schema definition for the 'get_views' tool provided in the ListTools MCP response, specifying no input parameters.name: "get_views", description: "获取 Revit 模型中的所有视图", inputSchema: { type: "object", properties: {} } }, {
- src/index.ts:205-221 (registration)Dynamic registration and dispatch logic in CallToolRequestSchema handler that maps tool name 'get_views' to service.getViews() method.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 = '';