open_document
Open Revit project files to enable AI-assisted modeling, editing, and management of building design elements within the Autodesk Revit environment.
Instructions
Open Document
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "open_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | No | File Path |
Implementation Reference
- src/tools/open_document.ts:12-39 (handler)Handler function that sends the 'open_document' command to the Revit client using the provided filePath parameter and returns the response or an error message.
async (args, extra) => { const params = { filePath: args.filePath, }; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand('open_document', params); }); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `document open failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } - src/tools/open_document.ts:9-11 (schema)Zod input schema defining an optional 'filePath' string parameter for the tool.
{ filePath: z.string().optional().describe('File Path'), }, - src/tools/open_document.ts:5-42 (registration)Registration of the 'open_document' tool via server.tool call within the registerOpenDocumentTool function, which is dynamically invoked during tool setup.
export function registerOpenDocumentTool(server: McpServer) { server.tool( 'open_document', 'Open Document', { filePath: z.string().optional().describe('File Path'), }, async (args, extra) => { const params = { filePath: args.filePath, }; try { const response = await withRevitConnection(async (revitClient) => { return await revitClient.sendCommand('open_document', params); }); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `document open failed: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); }