Skip to main content
Glama

Get Filament

get_filament

Look up detailed filament information by ID or name, with manufacturer and material filters to resolve ambiguous names.

Instructions

Get detailed information about a specific filament. Prefer lookup by ID (the [ID ] value returned by search_filaments) — that is the only unambiguous key. Name lookups are accepted but many filaments share the same name (e.g. "Black", "Jade White") because SpoolmanDB names are often colour-only; if a name is ambiguous you will get back a disambiguation list with IDs. You can pass manufacturer and material alongside name to narrow the match, or pass the full search_filaments display label (e.g. "[ID 1234] Bambu Lab — PLA — Jade White") in the name field and it will be parsed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoFilament ID (preferred — copy the [ID N] value from search_filaments). Accepts either a number or a numeric string (LLM clients often serialise IDs as strings).
nameNoFilament name. Accepts the bare name field (e.g. "Jade White"), or a full display label like "[ID 1234] Bambu Lab — PLA — Jade White".
manufacturerNoOptional disambiguator when looking up by name.
materialNoOptional material disambiguator when looking up by name (e.g. "PLA", "PETG").

Implementation Reference

  • Registers the 'get_filament' MCP tool with server, including input schema (id, name, manufacturer, material) and the async handler that performs filament lookup by ID or by name with disambiguation.
    export function registerGetFilament(
      server: McpServer,
      db: Database.Database,
    ): void {
      server.registerTool(
        'get_filament',
        {
          title: 'Get Filament',
          description:
            'Get detailed information about a specific filament. Prefer lookup by ID (the [ID <n>] value returned by search_filaments) — that is the only unambiguous key. Name lookups are accepted but many filaments share the same name (e.g. "Black", "Jade White") because SpoolmanDB names are often colour-only; if a name is ambiguous you will get back a disambiguation list with IDs. You can pass `manufacturer` and `material` alongside `name` to narrow the match, or pass the full search_filaments display label (e.g. "[ID 1234] Bambu Lab — PLA — Jade White") in the `name` field and it will be parsed.',
          inputSchema: {
            id: z
              .union([
                z.number().int().nonnegative(),
                z
                  .string()
                  .regex(/^\d+$/, 'id must be a non-negative integer')
                  .transform((s) => Number.parseInt(s, 10)),
              ])
              .optional()
              .describe(
                'Filament ID (preferred — copy the [ID N] value from search_filaments). Accepts either a number or a numeric string (LLM clients often serialise IDs as strings).',
              ),
            name: z
              .string()
              .optional()
              .describe(
                'Filament name. Accepts the bare name field (e.g. "Jade White"), or a full display label like "[ID 1234] Bambu Lab — PLA — Jade White".',
              ),
            manufacturer: z
              .string()
              .optional()
              .describe('Optional disambiguator when looking up by name.'),
            material: z
              .string()
              .optional()
              .describe(
                'Optional material disambiguator when looking up by name (e.g. "PLA", "PETG").',
              ),
          },
        },
        async ({ id, name, manufacturer, material }) => {
          let filament: FilamentRow | null = null;
    
          // 1. Direct ID lookup wins.
          if (id != null) {
            filament = getFilamentById(db, id);
          } else if (name != null) {
            // 2. Try parsing a display label first — it may contain an ID and/or
            //    manufacturer + material that uniquely identify the filament.
            const parsed = parseDisplayLabel(name);
            if (parsed?.id != null) {
              filament = getFilamentById(db, parsed.id);
            } else {
              const effectiveName = parsed?.name ?? name;
              const effectiveMfg = manufacturer ?? parsed?.manufacturer;
              const effectiveMaterial = material ?? parsed?.material;
              const matches = findFilamentsByName(
                db,
                effectiveName,
                effectiveMfg,
                effectiveMaterial,
              );
              if (matches.length === 1) {
                filament = matches[0];
              } else if (matches.length > 1) {
                return {
                  isError: true,
                  content: [
                    {
                      type: 'text' as const,
                      text: formatDisambiguation(matches, effectiveName),
                    },
                  ],
                };
              }
            }
          } else {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: 'Please provide either an id or name. Use search_filaments to find filaments first — every result includes an [ID N] value to copy.',
                },
              ],
            };
          }
    
          if (!filament) {
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `Filament not found. Try using search_filaments to find the correct ID, then pass that ID directly.`,
                },
              ],
            };
          }
    
          return {
            content: [
              { type: 'text' as const, text: formatFilamentDetail(filament) },
            ],
          };
        },
      );
    }
  • Input schema for get_filament: accepts optional id (number or numeric string), optional name (bare name or full display label), optional manufacturer and material for disambiguation.
    inputSchema: {
      id: z
        .union([
          z.number().int().nonnegative(),
          z
            .string()
            .regex(/^\d+$/, 'id must be a non-negative integer')
            .transform((s) => Number.parseInt(s, 10)),
        ])
        .optional()
        .describe(
          'Filament ID (preferred — copy the [ID N] value from search_filaments). Accepts either a number or a numeric string (LLM clients often serialise IDs as strings).',
        ),
      name: z
        .string()
        .optional()
        .describe(
          'Filament name. Accepts the bare name field (e.g. "Jade White"), or a full display label like "[ID 1234] Bambu Lab — PLA — Jade White".',
        ),
      manufacturer: z
        .string()
        .optional()
        .describe('Optional disambiguator when looking up by name.'),
      material: z
        .string()
        .optional()
        .describe(
          'Optional material disambiguator when looking up by name (e.g. "PLA", "PETG").',
        ),
    },
  • src/server.ts:44-44 (registration)
    Registration call in the server setup: calls registerGetFilament (imported from src/tools/get-filament.ts) to register the tool on the MCP server.
    registerGetFilament(server, db);
  • Parses a search_filaments display label like '[ID 1234] Bambu Lab — PLA — Jade White' back into its components (id, manufacturer, material, name).
    export function parseDisplayLabel(input: string): {
      id?: number;
      manufacturer?: string;
      material?: string;
      name?: string;
    } | null {
      const trimmed = input.trim();
      // Try to extract a leading "[ID N]" prefix.
      const idMatch = trimmed.match(/^\[ID\s+(\d+)\]\s*(.*)$/);
      let rest = trimmed;
      let id: number | undefined;
      if (idMatch) {
        id = Number(idMatch[1]);
        rest = idMatch[2].trim();
      }
      // Split on em dash with surrounding spaces. Hyphen-minus also tolerated.
      const parts = rest.split(/\s+[—–-]\s+/);
      if (parts.length === 3) {
        return {
          id,
          manufacturer: parts[0].trim(),
          material: parts[1].trim(),
          name: parts[2].trim(),
        };
      }
      if (id != null) {
        return { id };
      }
      return null;
    }
  • Formats a disambiguation message listing multiple filament matches with their IDs, manufacturer, material, name, and diameter when a name lookup is ambiguous.
    function formatDisambiguation(rows: FilamentRow[], name: string): string {
      const lines: string[] = [];
      lines.push(
        `Multiple filaments match name "${name}" (${rows.length} matches). Use the ID with get_filament for an exact match, or pass manufacturer/material to disambiguate:`,
      );
      lines.push('');
      for (const r of rows.slice(0, 25)) {
        lines.push(
          `- [ID ${r.id}] ${r.manufacturer_name} — ${r.material_name} — ${r.name} (${r.diameter}mm)`,
        );
      }
      if (rows.length > 25) {
        lines.push(`... and ${rows.length - 25} more.`);
      }
      return lines.join('\n');
    }
Behavior4/5

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

No annotations are provided, so the description carries full burden. It transparently explains behavior for name ambiguity (returns disambiguation list), and that it can parse display labels. However, it does not explicitly state whether the tool is read-only or idempotent.

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 concise yet informative, with no wasted sentences. It front-loads the purpose and efficiently covers usage nuances, disambiguation, and parsing logic.

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

Completeness4/5

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

The description covers the main use case and ambiguity handling well. However, it lacks details on the output format beyond mentioning a 'disambiguation list with IDs.' Since no output schema exists, describing the return structure would improve completeness.

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

Parameters4/5

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

Schema coverage is 100% with descriptions for each parameter. The description adds significant context beyond the schema, such as the disambiguation behavior and that id accepts numeric strings, making it more helpful for correct invocation.

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

Purpose5/5

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

The description clearly states 'Get detailed information about a specific filament,' with a specific verb and resource. It distinguishes from sibling tools like search_filaments which lists filaments, and get_material_profile which provides material profiles.

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

Usage Guidelines5/5

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

The description provides explicit guidance: prefer lookup by ID, explains why name lookups can be ambiguous, and suggests using disambiguators like manufacturer and material. It also explains that ambiguous names return a disambiguation list, helping the agent decide when to use this tool.

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/gregario/3dprint-oracle'

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