Skip to main content
Glama
helenkwok

Fragment MCP Server

load-frag

Load a .frag file to access Building Information Modeling data converted from IFC files, enabling BIM data querying by category.

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. It checks if the file exists and is a .frag file, loads the fragments using the loadFragments helper, and returns a success message with geometry info.
    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)
    Input schema for the 'load-frag' tool defining the filePath parameter.
    {
      filePath: z
        .string()
        .describe('Full path of the file to load with fragments'),
    },
  • main.ts:64-100 (registration)
    Registration of the 'load-frag' tool using server.tool, including description, schema, and handler.
    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)
              )}`,
            },
          ],
        }
      }
    )
  • Helper function loadFragments that reads the .frag file and creates a SingleThreadedFragmentsModel instance.
    export const loadFragments = async (filePath: string) => {
      const file = await fs.promises.readFile(filePath)
    
      const fragments = new FRAGS.SingleThreadedFragmentsModel('model', file)
      return fragments
    }
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 states the tool loads a file and requires a file-system server, but it doesn't disclose critical traits like whether this is a read-only operation, potential side effects (e.g., memory usage), error handling, or performance considerations. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is extremely concise with two short sentences that directly address the tool's function and requirement. Every word earns its place, and it is front-loaded with the core action, making it efficient and easy to parse.

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 the complexity of file loading operations, the lack of annotations and output schema, and the description's minimal detail, this is incomplete. It doesn't explain what 'load' means in terms of output (e.g., data structure, success/failure indicators) or behavioral nuances, which are crucial for effective tool invocation.

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 input schema has 100% description coverage, with the 'filePath' parameter well-documented in the schema. The description does not add any meaning beyond what the schema provides (e.g., it doesn't clarify file format expectations or path validation rules). According to the rules, with high schema coverage, the baseline is 3 even without 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 action ('Load') and the resource ('.frag file'), making the purpose understandable. It distinguishes from sibling tools like 'convert-ifc-to-frag' and 'fetch-elements-of-category' by focusing on loading rather than conversion or fetching. However, it doesn't specify what 'load' entails (e.g., reading, parsing, or processing), which prevents 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 mentions 'Needs file-system server', which provides some context about prerequisites, but it lacks explicit guidance on when to use this tool versus alternatives. There is no mention of when-not-to-use scenarios or comparisons with sibling tools, leaving usage decisions ambiguous.

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