diagnose_print
Diagnose 3D printing defects by describing observed issues to receive probable causes, corrective actions, and PrusaSlicer setting adjustments.
Instructions
Diagnostic post-impression basé sur la Bible FDM. Décris le défaut observé et obtiens les causes probables, les corrections à appliquer, et les réglages PrusaSlicer à modifier.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| defect | Yes | Description du défaut observé (ex: 'warping', 'stringing', 'sous-extrusion', 'couches décalées', 'ringing', 'elephant foot', 'délamination', 'buse bouchée') | |
| material | No | Matériau utilisé (PLA, PETG, ABS...) | |
| details | No | Détails supplémentaires sur le problème |
Implementation Reference
- src/tools/diagnose-print.ts:294-396 (handler)Main handler function that processes the diagnose_print tool request. It searches the diagnostic database for matching defects based on user input, performs fuzzy matching on symptoms if needed, and generates a detailed diagnostic response with symptoms, causes, material-specific notes, fixes, and PrusaSlicer settings.
async ({ defect, material, details }) => { const query = defect.toLowerCase().trim(); // Find matching diagnostics const matches = DIAGNOSTIC_DB.filter((entry) => entry.aliases.some((alias) => query.includes(alias)) || query.includes(entry.defect.toLowerCase()) ); // If no exact match, do fuzzy search on symptoms if (matches.length === 0) { const fuzzy = DIAGNOSTIC_DB.filter((entry) => entry.symptoms.some((s) => { const sLower = s.toLowerCase(); return query.split(/\s+/).some((word) => word.length > 3 && sLower.includes(word)); }) ); matches.push(...fuzzy); } if (matches.length === 0) { // Return all available defects as suggestions const available = DIAGNOSTIC_DB.map((e) => `- ${e.defect}`).join("\n"); return { content: [{ type: "text" as const, text: `Défaut non reconnu : "${defect}"\n\n` + `**Défauts diagnosticables :**\n${available}\n\n` + `_Décris le problème avec plus de détails ou utilise un des termes ci-dessus._`, }], }; } const lines: string[] = []; for (const entry of matches) { lines.push(`## ${entry.defect}`); lines.push(""); lines.push("### Symptômes"); for (const s of entry.symptoms) { lines.push(`- ${s}`); } lines.push(""); lines.push("### Causes probables"); for (const c of entry.causes) { lines.push(`- ${c}`); } lines.push(""); // Material-specific notes if (material) { const matUpper = material.toUpperCase(); const materialNotes: string[] = []; if (entry.defect.includes("Warping") && ["ABS", "ASA", "PC", "NYLON"].includes(matUpper)) { materialNotes.push(`${matUpper} est particulièrement sujet au warping — enceinte fermée OBLIGATOIRE`); } if (entry.defect.includes("Stringing") && matUpper === "PETG") { materialNotes.push("PETG est connu pour le stringing — réduire temp à 230°C, rétraction max 0.8-1mm"); } if (entry.defect.includes("Stringing") && matUpper === "TPU") { materialNotes.push("TPU : rétraction très limitée (0.5mm max). Accepter un peu de stringing ou post-traiter."); } if (entry.defect.includes("Délamination") && ["ABS", "ASA"].includes(matUpper)) { materialNotes.push(`${matUpper} : ventilateur à 0%, enceinte fermée, temp buse 255-260°C minimum`); } if (materialNotes.length > 0) { lines.push(`### Notes spécifiques ${matUpper}`); for (const note of materialNotes) { lines.push(`- ${note}`); } lines.push(""); } } lines.push("### Corrections recommandées (Bible FDM)"); for (let i = 0; i < entry.fixes.length; i++) { lines.push(`${i + 1}. ${entry.fixes[i]}`); } lines.push(""); lines.push("### Réglages PrusaSlicer à modifier"); for (const [key, value] of Object.entries(entry.preventionSettings)) { lines.push(`- **${key}** : ${value}`); } lines.push(""); } if (details) { lines.push(`_Détails fournis : ${details}_`); lines.push(""); } lines.push("---"); lines.push("_Diagnostic basé sur la Bible de l'impression 3D FDM et les recommandations Prusa officielles._"); return { content: [{ type: "text" as const, text: lines.join("\n") }], }; }, - src/tools/diagnose-print.ts:285-292 (schema)Input schema definition using zod for the diagnose_print tool. Defines three optional parameters: defect (required), material (optional), and details (optional) with descriptions.
inputSchema: { defect: z.string().describe( "Description du défaut observé (ex: 'warping', 'stringing', 'sous-extrusion', " + "'couches décalées', 'ringing', 'elephant foot', 'délamination', 'buse bouchée')" ), material: z.string().optional().describe("Matériau utilisé (PLA, PETG, ABS...)"), details: z.string().optional().describe("Détails supplémentaires sur le problème"), }, - src/tools/diagnose-print.ts:276-398 (registration)The registerDiagnosePrint function that registers the diagnose_print tool with the MCP server. Includes tool metadata (title, description), input schema, and the async handler function.
export function registerDiagnosePrint(server: McpServer) { server.registerTool( "diagnose_print", { title: "Diagnostiquer un défaut d'impression", description: "Diagnostic post-impression basé sur la Bible FDM. " + "Décris le défaut observé et obtiens les causes probables, " + "les corrections à appliquer, et les réglages PrusaSlicer à modifier.", inputSchema: { defect: z.string().describe( "Description du défaut observé (ex: 'warping', 'stringing', 'sous-extrusion', " + "'couches décalées', 'ringing', 'elephant foot', 'délamination', 'buse bouchée')" ), material: z.string().optional().describe("Matériau utilisé (PLA, PETG, ABS...)"), details: z.string().optional().describe("Détails supplémentaires sur le problème"), }, }, async ({ defect, material, details }) => { const query = defect.toLowerCase().trim(); // Find matching diagnostics const matches = DIAGNOSTIC_DB.filter((entry) => entry.aliases.some((alias) => query.includes(alias)) || query.includes(entry.defect.toLowerCase()) ); // If no exact match, do fuzzy search on symptoms if (matches.length === 0) { const fuzzy = DIAGNOSTIC_DB.filter((entry) => entry.symptoms.some((s) => { const sLower = s.toLowerCase(); return query.split(/\s+/).some((word) => word.length > 3 && sLower.includes(word)); }) ); matches.push(...fuzzy); } if (matches.length === 0) { // Return all available defects as suggestions const available = DIAGNOSTIC_DB.map((e) => `- ${e.defect}`).join("\n"); return { content: [{ type: "text" as const, text: `Défaut non reconnu : "${defect}"\n\n` + `**Défauts diagnosticables :**\n${available}\n\n` + `_Décris le problème avec plus de détails ou utilise un des termes ci-dessus._`, }], }; } const lines: string[] = []; for (const entry of matches) { lines.push(`## ${entry.defect}`); lines.push(""); lines.push("### Symptômes"); for (const s of entry.symptoms) { lines.push(`- ${s}`); } lines.push(""); lines.push("### Causes probables"); for (const c of entry.causes) { lines.push(`- ${c}`); } lines.push(""); // Material-specific notes if (material) { const matUpper = material.toUpperCase(); const materialNotes: string[] = []; if (entry.defect.includes("Warping") && ["ABS", "ASA", "PC", "NYLON"].includes(matUpper)) { materialNotes.push(`${matUpper} est particulièrement sujet au warping — enceinte fermée OBLIGATOIRE`); } if (entry.defect.includes("Stringing") && matUpper === "PETG") { materialNotes.push("PETG est connu pour le stringing — réduire temp à 230°C, rétraction max 0.8-1mm"); } if (entry.defect.includes("Stringing") && matUpper === "TPU") { materialNotes.push("TPU : rétraction très limitée (0.5mm max). Accepter un peu de stringing ou post-traiter."); } if (entry.defect.includes("Délamination") && ["ABS", "ASA"].includes(matUpper)) { materialNotes.push(`${matUpper} : ventilateur à 0%, enceinte fermée, temp buse 255-260°C minimum`); } if (materialNotes.length > 0) { lines.push(`### Notes spécifiques ${matUpper}`); for (const note of materialNotes) { lines.push(`- ${note}`); } lines.push(""); } } lines.push("### Corrections recommandées (Bible FDM)"); for (let i = 0; i < entry.fixes.length; i++) { lines.push(`${i + 1}. ${entry.fixes[i]}`); } lines.push(""); lines.push("### Réglages PrusaSlicer à modifier"); for (const [key, value] of Object.entries(entry.preventionSettings)) { lines.push(`- **${key}** : ${value}`); } lines.push(""); } if (details) { lines.push(`_Détails fournis : ${details}_`); lines.push(""); } lines.push("---"); lines.push("_Diagnostic basé sur la Bible de l'impression 3D FDM et les recommandations Prusa officielles._"); return { content: [{ type: "text" as const, text: lines.join("\n") }], }; }, ); } - src/index.ts:22-22 (registration)Import statement for registerDiagnosePrint function in the main server entry point.
import { registerDiagnosePrint } from "./tools/diagnose-print.js"; - src/index.ts:50-50 (registration)Registration call for the diagnose_print tool in the main server initialization.
registerDiagnosePrint(server);