Skip to main content
Glama
helenkwok

Fragment MCP Server

convert-ifc-to-frag

Convert IFC BIM files to fragment format for processing and querying building information model data.

Instructions

Convert an IFC file to a .frag file. Needs file-system server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYesFull path of the IFC file to convert
outputPathYesFull path where the output .frags file will be saved

Implementation Reference

  • main.ts:24-61 (handler)
    The main tool handler function for 'convert-ifc-to-frag', which performs file existence checks, invokes the core conversion function, and formats the response.
    async ({ inputPath, outputPath }) => {
      if (!fs.existsSync(inputPath)) {
        return {
          content: [
            {
              type: 'text',
              text: 'IFC file not found. Please provide a valid .ifc file path.',
            },
          ],
        }
      }
    
      if (fs.existsSync(outputPath)) {
        return {
          content: [
            {
              type: 'text',
              text: 'Output .frag file already exists. Please call load-frag directly',
            },
          ],
        }
      }
    
     const model = await convertIfcToFragment(inputPath, outputPath)
    
      return {
        content: [
          {
            type: 'text',
            text: `Converted IFC file to .frag format. Output saved to ${outputPath}. Model contains ${
              model.getItemsWithGeometry().length
            } items with geometry: ${JSON.stringify(
              fetchCategoriesWithGeometry(fragments)
            )}`,
          },
        ],
      }
    }
  • main.ts:18-23 (schema)
    Zod schema defining the input parameters for the tool: inputPath and outputPath.
    {
      inputPath: z.string().describe('Full path of the IFC file to convert'),
      outputPath: z
        .string()
        .describe('Full path where the output .frags file will be saved'),
    },
  • main.ts:15-62 (registration)
    Registers the 'convert-ifc-to-frag' tool with MCP server, specifying name, description, schema, and handler.
    server.tool(
      'convert-ifc-to-frag',
      'Convert an IFC file to a .frag file. Needs file-system server',
      {
        inputPath: z.string().describe('Full path of the IFC file to convert'),
        outputPath: z
          .string()
          .describe('Full path where the output .frags file will be saved'),
      },
      async ({ inputPath, outputPath }) => {
        if (!fs.existsSync(inputPath)) {
          return {
            content: [
              {
                type: 'text',
                text: 'IFC file not found. Please provide a valid .ifc file path.',
              },
            ],
          }
        }
    
        if (fs.existsSync(outputPath)) {
          return {
            content: [
              {
                type: 'text',
                text: 'Output .frag file already exists. Please call load-frag directly',
              },
            ],
          }
        }
    
       const model = await convertIfcToFragment(inputPath, outputPath)
    
        return {
          content: [
            {
              type: 'text',
              text: `Converted IFC file to .frag format. Output saved to ${outputPath}. Model contains ${
                model.getItemsWithGeometry().length
              } items with geometry: ${JSON.stringify(
                fetchCategoriesWithGeometry(fragments)
              )}`,
            },
          ],
        }
      }
    )
  • Core helper function that performs the actual IFC to .frag conversion using FRAGS.IfcImporter and saves the output file.
    export const convertIfcToFragment = async (
      inputPath: string,
      outputPath: string
    ) => {
      const ifcFile = await fs.promises.readFile(inputPath)
      const typedArray = new Uint8Array(ifcFile)
      const serializer = new FRAGS.IfcImporter()
      serializer.wasm = {
        path: '/',
        absolute: false,
      }
      const bytes = await serializer.process({ bytes: typedArray, raw: false })
      const model = new FRAGS.SingleThreadedFragmentsModel('model', bytes)
    
      await fs.promises.writeFile(outputPath, bytes)
    
      return model
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'Needs file-system server' which adds useful context about infrastructure requirements, but it doesn't describe other behavioral traits like whether the conversion is destructive, what happens if files already exist, error conditions, or performance characteristics. For a file conversion tool with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that each serve a purpose: the first states the core functionality, the second provides important context about server requirements. There's no unnecessary verbiage, and the information is front-loaded with the primary purpose stated first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that this is a file conversion tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the .frag format is, what the conversion entails, potential limitations, or what happens upon completion. The 'Needs file-system server' hint helps but doesn't compensate for the lack of behavioral and output information that would help an agent use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters (inputPath and outputPath) clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. According to the rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: converting an IFC file to a .frag file. It specifies both the input format (IFC) and output format (.frag), making the verb+resource combination explicit. However, it doesn't differentiate from sibling tools like 'load-frag' which might handle .frag files differently, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance with 'Needs file-system server' indicating a prerequisite, but it doesn't explain when to use this tool versus alternatives like 'load-frag' or 'fetch-elements-of-category'. There's no explicit when/when-not guidance or comparison with sibling tools, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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