Skip to main content
Glama

Diagnose Print Issue

diagnose_print_issue

Diagnose 3D print issues by symptom. Get ranked causes and fixes, with optional material-specific filtering.

Instructions

Diagnose a 3D printing problem by symptom. Returns possible causes ranked by probability, with specific fixes for each. Optionally filter by material type for material-specific troubleshooting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symptomYesThe print issue symptom (e.g., "stringing", "warping", "layer_adhesion", "clogging", "elephant_foot")
materialNoMaterial type for material-specific diagnosis (e.g., "PLA", "PETG")

Implementation Reference

  • Full handler function that registers the 'diagnose_print_issue' tool on the MCP server. Takes symptom (required) and material (optional) inputs, queries the database for troubleshooting entries, sorts them by material-specificity then probability, and returns formatted results or an error with available symptoms if none found.
    export function registerDiagnosePrintIssue(
      server: McpServer,
      db: Database.Database,
    ): void {
      server.registerTool(
        'diagnose_print_issue',
        {
          title: 'Diagnose Print Issue',
          description:
            'Diagnose a 3D printing problem by symptom. Returns possible causes ranked by probability, with specific fixes for each. Optionally filter by material type for material-specific troubleshooting.',
          inputSchema: {
            symptom: z
              .string()
              .describe(
                'The print issue symptom (e.g., "stringing", "warping", "layer_adhesion", "clogging", "elephant_foot")',
              ),
            material: z
              .string()
              .optional()
              .describe(
                'Material type for material-specific diagnosis (e.g., "PLA", "PETG")',
              ),
          },
        },
        async ({ symptom, material }) => {
          const entries = getTroubleshooting(db, symptom.toLowerCase(), material);
    
          if (entries.length === 0) {
            const available = getAvailableSymptoms(db);
            return {
              isError: true,
              content: [
                {
                  type: 'text' as const,
                  text: `No troubleshooting data found for symptom "${symptom}". Available symptoms: ${available.join(', ')}`,
                },
              ],
            };
          }
    
          // Sort: material-specific first, then by probability
          const probOrder: Record<string, number> = { high: 0, medium: 1, low: 2 };
          const sorted = [...entries].sort((a, b) => {
            // Material-specific entries first when material is provided
            if (material) {
              const aSpecific = a.material_name ? 0 : 1;
              const bSpecific = b.material_name ? 0 : 1;
              if (aSpecific !== bSpecific) return aSpecific - bSpecific;
            }
            return (probOrder[a.probability] ?? 1) - (probOrder[b.probability] ?? 1);
          });
    
          const header = material
            ? `# Diagnosing "${symptom}" (${material})`
            : `# Diagnosing "${symptom}"`;
    
          const lines = [header, ''];
          for (const entry of sorted) {
            const materialTag = entry.material_name
              ? ` [${entry.material_name}-specific]`
              : '';
            lines.push(`## ${entry.cause}${materialTag}`);
            lines.push(`- Probability: ${entry.probability}`);
            lines.push(`- Fix: ${entry.fix}`);
            lines.push('');
          }
    
          return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
        },
      );
    }
  • Input schema defined inline using Zod. 'symptom' is a required string describing the print issue, 'material' is an optional string for filtering by material type.
    inputSchema: {
      symptom: z
        .string()
        .describe(
          'The print issue symptom (e.g., "stringing", "warping", "layer_adhesion", "clogging", "elephant_foot")',
        ),
      material: z
        .string()
        .optional()
        .describe(
          'Material type for material-specific diagnosis (e.g., "PLA", "PETG")',
        ),
    },
  • src/server.ts:50-50 (registration)
    Registration of the tool's register function in the main server creation, passing the server instance and database connection.
    registerDiagnosePrintIssue(server, db);
  • src/server.ts:17-17 (registration)
    Import of the registration function in the server module.
    import { registerDiagnosePrintIssue } from './tools/diagnose-print-issue.js';
  • Database helper that queries the 'troubleshooting' table by symptom and optionally by material. Returns rows ordered by probability descending.
    export function getTroubleshooting(
      db: Database.Database,
      symptom: string,
      material?: string,
    ): TroubleshootingRow[] {
      if (material) {
        return db
          .prepare(
            `SELECT * FROM troubleshooting
             WHERE symptom = ? AND (material_name = ? OR material_name IS NULL)
             ORDER BY probability DESC`,
          )
          .all(symptom, material) as TroubleshootingRow[];
      }
      return db
        .prepare(
          `SELECT * FROM troubleshooting
           WHERE symptom = ?
           ORDER BY probability DESC`,
        )
        .all(symptom) as TroubleshootingRow[];
    }
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 discloses that results are ranked by probability and include specific fixes, and mentions optional material filtering. This is sufficient for a read-only diagnostic tool.

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?

Two efficient sentences with front-loaded action and output description. No redundant or extraneous words.

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?

Given no annotations and output schema, the description covers purpose, output, and optional filtering. It could mention output format or read-only nature, but for a simple tool it is fairly complete.

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 coverage is 100% with adequate descriptions for both parameters. The description reiterates the optional material filter but does not add new meaning beyond the schema. Baseline of 3 is appropriate.

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 diagnoses 3D printing problems by symptom, returning ranked causes and fixes. It distinguishes itself from sibling tools, which are all material-related, by focusing on diagnosis.

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

Usage Guidelines4/5

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

The description implicitly indicates use when troubleshooting a specific symptom. It does not explicitly state when not to use or name alternatives, but the context is clear given sibling tools cover separate material functions.

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