Skip to main content
Glama

Compare Materials

compare_materials

Compare 2-3 3D printing materials across strength, flexibility, heat resistance, and other properties to choose the right filament for your project.

Instructions

Compare 2-3 material types side by side across all properties: strength, flexibility, heat resistance, food safety, print difficulty, and more. Useful for deciding which material to use for a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
materialsYesArray of 2-3 material type names to compare (e.g., ["PLA", "PETG", "ABS"])

Implementation Reference

  • Registers and implements the compare_materials tool handler. Fetches 2-3 material profiles from DB and builds a comparison table with properties like print temp, strength, flexibility, UV resistance, food safety, etc., plus a 'When to use each' summary.
    export function registerCompareMaterials(
      server: McpServer,
      db: Database.Database,
    ): void {
      server.registerTool(
        'compare_materials',
        {
          title: 'Compare Materials',
          description:
            'Compare 2-3 material types side by side across all properties: strength, flexibility, heat resistance, food safety, print difficulty, and more. Useful for deciding which material to use for a project.',
          inputSchema: {
            materials: z
              .array(z.string())
              .min(2)
              .max(3)
              .describe(
                'Array of 2-3 material type names to compare (e.g., ["PLA", "PETG", "ABS"])',
              ),
          },
        },
        async ({ materials }) => {
          const profiles: MaterialProfileRow[] = [];
          for (const name of materials) {
            let profile = getMaterialProfile(db, name);
            if (!profile) {
              profile = getMaterialProfile(db, name.toUpperCase());
            }
            if (!profile) {
              return {
                isError: true,
                content: [
                  {
                    type: 'text' as const,
                    text: `Material "${name}" not found. Cannot compare. Available materials: ${getAvailableMaterialNames(db).join(', ')}`,
                  },
                ],
              };
            }
            profiles.push(profile);
          }
    
          const names = profiles.map((p) => p.material_name);
          const header = `# Material Comparison: ${names.join(' vs ')}\n`;
    
          const properties: { label: string; getter: (p: MaterialProfileRow) => string }[] = [
            { label: 'Print Temp', getter: (p) => `${p.print_temp_min}-${p.print_temp_max}°C` },
            { label: 'Bed Temp', getter: (p) => `${p.bed_temp_min}-${p.bed_temp_max}°C` },
            { label: 'Strength', getter: (p) => p.strength },
            { label: 'Flexibility', getter: (p) => p.flexibility },
            { label: 'UV Resistance', getter: (p) => p.uv_resistance },
            { label: 'Food Safe', getter: (p) => p.food_safe },
            { label: 'Moisture Sensitivity', getter: (p) => p.moisture_sensitivity },
            { label: 'Difficulty', getter: (p) => p.difficulty },
            { label: 'Enclosure Needed', getter: (p) => p.enclosure_needed ? 'Yes' : 'No' },
            { label: 'Nozzle', getter: (p) => p.nozzle_notes ?? 'Standard' },
          ];
    
          // Build table
          const colWidth = 25;
          const labelWidth = 22;
          const separator = '-'.repeat(labelWidth + colWidth * names.length + names.length + 1);
    
          let table = `| ${'Property'.padEnd(labelWidth)}|`;
          for (const name of names) {
            table += ` ${name.padEnd(colWidth - 1)}|`;
          }
          table += '\n' + separator + '\n';
    
          for (const prop of properties) {
            let row = `| ${prop.label.padEnd(labelWidth)}|`;
            for (const profile of profiles) {
              const val = prop.getter(profile);
              row += ` ${val.substring(0, colWidth - 2).padEnd(colWidth - 1)}|`;
            }
            table += row + '\n';
          }
    
          // When to use summary
          const whenToUse = profiles
            .map(
              (p) => `- **${p.material_name}**: ${p.typical_uses} (${p.pros})`,
            )
            .join('\n');
    
          const text = [
            header,
            table,
            '',
            '## When to use each',
            whenToUse,
          ].join('\n');
    
          return { content: [{ type: 'text' as const, text }] };
        },
      );
    }
  • Input schema defining the 'materials' parameter: an array of 2-3 strings representing material names to compare.
    inputSchema: {
      materials: z
        .array(z.string())
        .min(2)
        .max(3)
        .describe(
          'Array of 2-3 material type names to compare (e.g., ["PLA", "PETG", "ABS"])',
        ),
    },
  • src/server.ts:48-48 (registration)
    Registration call in the main server setup, passing the server instance and database to register the compare_materials tool.
    registerCompareMaterials(server, db);
  • Helper function that queries the database for a material profile by name. Used by the compare_materials handler to fetch each material's data.
    export function getMaterialProfile(
      db: Database.Database,
      name: string,
    ): MaterialProfileRow | null {
      const row = db
        .prepare('SELECT * FROM material_profiles WHERE material_name = ?')
        .get(name) as MaterialProfileRow | undefined;
      return row ?? null;
    }
  • Helper function that returns all available material names from the database. Used by compare_materials to list valid options when a material is not found.
    export function getAvailableMaterialNames(db: Database.Database): string[] {
      const rows = db
        .prepare(
          'SELECT DISTINCT material_name FROM material_profiles ORDER BY material_name',
        )
        .all() as { material_name: string }[];
      return rows.map((r) => r.material_name);
    }
Behavior3/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. It mentions the comparison covers 'all properties' and lists examples, but does not disclose data source, whether results are static or dynamic, or any limitations.

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 concise sentence that effectively communicates the tool's purpose and key details without unnecessary words. It is well-structured and easy to parse.

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

Completeness3/5

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

For a comparison tool, the description lacks details on the output format (e.g., table, scores) and does not explain how results are presented. Given no output schema, more context on the output would be beneficial.

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, providing clear details on the parameter (array of 2-3 material names). The description adds context about comparing across properties but does not add significant new meaning beyond the schema.

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 the tool compares 2-3 material types across specific properties, using a specific verb and resource. It distinguishes from sibling tools like recommend_material or get_material_profile by focusing on side-by-side comparison.

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

Usage Guidelines3/5

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

The description implies usage for deciding which material to use but does not explicitly state when not to use it or mention alternative tools like recommend_material that might be more suitable for open-ended recommendations.

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