Skip to main content
Glama

get_current_view_info

Retrieve details about the active view in Revit, including view type, name, and scale, to understand the current working environment.

Instructions

获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler logic for the 'get_current_view_info' MCP tool. It handles the tool call by connecting to Revit via withRevitConnection, sending the 'get_current_view_info' command, returning the JSON response as text content, or an error message on failure.
    server.tool('get_current_view_info', '获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。', {}, async (args, extra) => { console.error('[DEBUG] Tool get_current_view_info called with args:', args); try { console.error('[DEBUG] Establishing connection to Revit'); const response = await withRevitConnection(async (revitClient) => { console.error('[DEBUG] Sending get_current_view_info command to Revit'); return await revitClient.sendCommand('get_current_view_info', {}); }); console.error('[DEBUG] Received response from Revit:', JSON.stringify(response).substring(0, 200) + '...'); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { console.error('[DEBUG] Error in get_current_view_info:', error); return { content: [ { type: 'text', text: `get current view info failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } });
  • The registration function for the 'get_current_view_info' tool. It calls server.tool() to register the tool with its description, empty schema, and inline handler. This function is dynamically imported and invoked by src/tools/register.ts during server startup.
    export function registerGetCurrentViewInfoTool(server: McpServer) { console.error('[DEBUG] Registering get_current_view_info tool'); server.tool('get_current_view_info', '获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。', {}, async (args, extra) => { console.error('[DEBUG] Tool get_current_view_info called with args:', args); try { console.error('[DEBUG] Establishing connection to Revit'); const response = await withRevitConnection(async (revitClient) => { console.error('[DEBUG] Sending get_current_view_info command to Revit'); return await revitClient.sendCommand('get_current_view_info', {}); }); console.error('[DEBUG] Received response from Revit:', JSON.stringify(response).substring(0, 200) + '...'); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { console.error('[DEBUG] Error in get_current_view_info:', error); return { content: [ { type: 'text', text: `get current view info failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }); console.error('[DEBUG] get_current_view_info tool registered successfully'); }

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/ideook/revit-mcp'

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