Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathNoFile Path

Implementation Reference

  • 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)}`,
            },
          ],
        };
      }
  • Zod input schema defining an optional 'filePath' string parameter for the tool.
    {
      filePath: z.string().optional().describe('File Path'),
    },
  • 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)}`,
                },
              ],
            };
          }
        }
      );
    }

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