get_current_view_info
Retrieve detailed information about the active view in Revit, including view type, name, scale, and other essential attributes, enabling efficient workflow automation and data access.
Instructions
获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/get_current_view_info.ts:9-35 (handler)The handler function that implements the core logic of the 'get_current_view_info' tool. It connects to Revit via withRevitConnection, sends the 'get_current_view_info' command, formats the response as JSON text, and handles errors.async (args, extra) => { try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand("get_current_view_info", {}); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `get current view info failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } }
- src/tools/get_current_view_info.ts:5-36 (registration)Registers the 'get_current_view_info' tool on the MCP server, specifying the tool name, Chinese description, empty input schema {}, and references the handler function. This function is dynamically loaded and called from src/tools/register.ts.server.tool( "get_current_view_info", "获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。", {}, async (args, extra) => { try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand("get_current_view_info", {}); }); return { content: [ { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `get current view info failed: ${ error instanceof Error ? error.message : String(error) }`, }, ], }; } } );