Skip to main content
Glama
helenkwok

Fragment MCP Server

fetch-elements-of-category

Retrieve BIM elements by category from IFC files, enabling structured querying of building information model data with configurable attribute and relation options.

Instructions

Fetch elements of a specified category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory name. e.g. IFCWALL
configYesConfiguration for fetching elements

Implementation Reference

  • main.ts:124-146 (handler)
    MCP server tool handler function. Checks if fragments are loaded, calls the core fetchElementsOfCategory helper, and returns the results as JSON text content.
    ({ category, config }) => {
      if (!fragments) {
        return {
          content: [
            {
              type: 'text',
              text: 'No fragments loaded. Please call load-frag first.',
            },
          ],
        }
      }
    
      const itemsData = fetchElementsOfCategory(fragments, category, config)
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(itemsData),
          },
        ],
      }
    }
  • Zod schema for tool inputs: category (string) and config (object with attributesDefault, attributes array, and relations for HasAssociations and IsDefinedBy).
    {
      category: z.string().describe('Category name. e.g. IFCWALL'),
      config: z
        .object({
          attributesDefault: z.boolean(),
          attributes: z.array(z.string()),
          relations: z.object({
            HasAssociations: z.object({
              attributes: z.boolean(),
              relations: z.boolean(),
            }),
            IsDefinedBy: z.object({
              attributes: z.boolean(),
              relations: z.boolean(),
            }),
          }),
        })
        .describe('Configuration for fetching elements'),
    },
  • main.ts:102-147 (registration)
    Registration of the 'fetch-elements-of-category' tool using server.tool(), including name, description, schema, and handler.
    server.tool(
      'fetch-elements-of-category',
      'Fetch elements of a specified category',
      {
        category: z.string().describe('Category name. e.g. IFCWALL'),
        config: z
          .object({
            attributesDefault: z.boolean(),
            attributes: z.array(z.string()),
            relations: z.object({
              HasAssociations: z.object({
                attributes: z.boolean(),
                relations: z.boolean(),
              }),
              IsDefinedBy: z.object({
                attributes: z.boolean(),
                relations: z.boolean(),
              }),
            }),
          })
          .describe('Configuration for fetching elements'),
      },
      ({ category, config }) => {
        if (!fragments) {
          return {
            content: [
              {
                type: 'text',
                text: 'No fragments loaded. Please call load-frag first.',
              },
            ],
          }
        }
    
        const itemsData = fetchElementsOfCategory(fragments, category, config)
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(itemsData),
            },
          ],
        }
      }
    )
  • Core helper function that implements the logic to fetch elements of a category: gets items matching category regex, filters valid IDs, and retrieves items data with given config.
    export const fetchElementsOfCategory = (
      fragments: FRAGS.SingleThreadedFragmentsModel,
      category: string,
      config: Partial<FRAGS.ItemsDataConfig>
    ) => {
      const elementsOfCategory = fragments.getItemsOfCategories([
        safeRegExp(category),
      ]);
      const ids = Object.values(elementsOfCategory)
        .flat()
        .filter((id) => id !== undefined && id !== null);
      const itemsData = fragments.getItemsData(ids, config);
    
      return itemsData;
    };
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'fetch' which implies a read operation, but doesn't disclose critical traits like whether it's safe, what permissions are needed, rate limits, pagination, or what happens on errors. For a tool with complex nested parameters and no annotations, this is a significant gap in transparency.

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 a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, stating the core purpose without unnecessary elaboration. Every word earns its place, making it easy to parse quickly.

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 (nested objects, no output schema, no annotations), the description is incomplete. It doesn't explain what 'elements' are, the return format, or how the config affects results. For a tool with rich input schema but no output schema, more context is needed to understand its behavior and usage fully.

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?

Schema description coverage is 100%, with both parameters ('category' and 'config') well-documented in the schema. The description adds no additional meaning beyond the schema, such as explaining the purpose of the config object or providing examples beyond the basic 'e.g. IFCWALL' in the schema. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Fetch elements of a specified category' clearly states the action (fetch) and target (elements of a category), but it's vague about what 'elements' are and doesn't distinguish from sibling tools like 'convert-ifc-to-frag' or 'load-frag'. It provides a basic purpose without specific context about the domain (e.g., IFC/BIM data).

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?

No guidance is provided on when to use this tool versus alternatives. The description lacks context about prerequisites, when this tool is appropriate, or any exclusions. With sibling tools like 'convert-ifc-to-frag' and 'load-frag', there's no indication of how this tool relates to them or when to choose one over another.

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