Skip to main content
Glama

load-frag

Load a .frag file into the Fragment MCP Server to process and query Building Information Modeling (BIM) data by category. Requires the file path of the fragment file.

Instructions

Load a .frag file. Needs file-system server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesFull path of the file to load with fragments

Implementation Reference

  • main.ts:72-99 (handler)
    The handler function for the 'load-frag' tool. Validates the .frag file path, loads the fragments using loadFragments, stores in global variable, and returns loaded stats.
    async ({ filePath }) => { if (!fs.existsSync(filePath) || filePath.endsWith('.ifc')) { return { content: [ { type: 'text', text: `No .frag file found. Please call convert-ifc-to-frag first: Input file path: ${filePath.replace( '.frag', '.ifc' )}; Output file path: ${filePath.replace('.ifc', '.frag')}`, }, ], } } fragments = await loadFragments(filePath) return { content: [ { type: 'text', text: `Loaded fragments from ${filePath}. Loaded ${fragments.getItemsWithGeometry().length} items with geometry: ${JSON.stringify( fetchCategoriesWithGeometry(fragments) )}`, }, ], } }
  • main.ts:67-71 (schema)
    Zod input schema defining the filePath parameter for load-frag tool.
    { filePath: z .string() .describe('Full path of the file to load with fragments'), },
  • main.ts:64-100 (registration)
    Registers the load-frag tool on the MCP server including name, description, schema, and handler reference.
    server.tool( 'load-frag', 'Load a .frag file. Needs file-system server', { filePath: z .string() .describe('Full path of the file to load with fragments'), }, async ({ filePath }) => { if (!fs.existsSync(filePath) || filePath.endsWith('.ifc')) { return { content: [ { type: 'text', text: `No .frag file found. Please call convert-ifc-to-frag first: Input file path: ${filePath.replace( '.frag', '.ifc' )}; Output file path: ${filePath.replace('.ifc', '.frag')}`, }, ], } } fragments = await loadFragments(filePath) return { content: [ { type: 'text', text: `Loaded fragments from ${filePath}. Loaded ${fragments.getItemsWithGeometry().length} items with geometry: ${JSON.stringify( fetchCategoriesWithGeometry(fragments) )}`, }, ], } } )
  • Core helper that asynchronously reads the .frag file and initializes the SingleThreadedFragmentsModel.
    export const loadFragments = async (filePath: string) => { const file = await fs.promises.readFile(filePath) const fragments = new FRAGS.SingleThreadedFragmentsModel('model', file) return fragments }

Other Tools

Related Tools

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/helenkwok/openbim-mcp'

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