get_current_document_info
Retrieve details of the active Revit view, including type, name, and scale, to understand the current document context for project tasks.
Instructions
获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The inline async handler for the get_current_document_info MCP tool. It connects to Revit via withRevitConnection, sends the 'get_current_document_info' command, formats the response as text content, and handles errors.server.tool('get_current_document_info', '获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。', {}, async (args, extra) => { console.error('[DEBUG] Tool get_current_document_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_document_info command to Revit'); return await revitClient.sendCommand('get_current_document_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_document_info:', error); return { content: [ { type: 'text', text: `get current document info failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } });
- src/tools/get_current_document_info.ts:4-39 (registration)Exports the registerGetCurrentDocumentInfoTool function, which registers the 'get_current_document_info' tool on the MCP server with a Chinese description, empty input schema, and the handler function.export function registerGetCurrentDocumentInfoTool(server: McpServer) { console.error('[DEBUG] Registering get_current_document_info tool'); server.tool('get_current_document_info', '获取 Revit 当前活动视图的详细信息,包括视图类型、名称、比例等属性。', {}, async (args, extra) => { console.error('[DEBUG] Tool get_current_document_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_document_info command to Revit'); return await revitClient.sendCommand('get_current_document_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_document_info:', error); return { content: [ { type: 'text', text: `get current document info failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }); console.error('[DEBUG] get_current_document_info tool registered successfully'); }