Get Material Profile
get_material_profileGet a comprehensive material science profile for any 3D printing filament, covering strength, flexibility, UV resistance, food safety, and more.
Instructions
Get a detailed material science profile for a specific material type. Includes strength, flexibility, UV resistance, food safety, moisture sensitivity, difficulty level, typical uses, pros/cons, and nozzle requirements.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| material | Yes | Material type name (e.g., "PLA", "PETG", "ABS", "TPU") |
Implementation Reference
- src/tools/get-material-profile.ts:9-73 (handler)The main handler registration function 'registerGetMaterialProfile' that registers the 'get_material_profile' tool on the MCP server. It defines the input schema (material name string), queries the database with fallback uppercase matching, returns a formatted markdown profile or an error with available materials if not found.
export function registerGetMaterialProfile( server: McpServer, db: Database.Database, ): void { server.registerTool( 'get_material_profile', { title: 'Get Material Profile', description: 'Get a detailed material science profile for a specific material type. Includes strength, flexibility, UV resistance, food safety, moisture sensitivity, difficulty level, typical uses, pros/cons, and nozzle requirements.', inputSchema: { material: z .string() .describe('Material type name (e.g., "PLA", "PETG", "ABS", "TPU")'), }, }, async ({ material }) => { // Try exact match first, then uppercase let profile = getMaterialProfile(db, material); if (!profile) { profile = getMaterialProfile(db, material.toUpperCase()); } if (!profile) { const available = getAvailableMaterialNames(db); return { isError: true, content: [ { type: 'text' as const, text: `Material "${material}" not found. Available materials: ${available.join(', ')}`, }, ], }; } const lines = [ `# ${profile.material_name} Material Profile`, '', '## Temperature Settings', `- Print Temperature: ${profile.print_temp_min}-${profile.print_temp_max}°C`, `- Bed Temperature: ${profile.bed_temp_min}-${profile.bed_temp_max}°C`, '', '## Properties', `- Strength: ${profile.strength}`, `- Flexibility: ${profile.flexibility}`, `- UV Resistance: ${profile.uv_resistance}`, `- Food Safe: ${profile.food_safe}`, `- Moisture Sensitivity: ${profile.moisture_sensitivity}`, '', '## Printing', `- Difficulty: ${profile.difficulty}`, `- Nozzle: ${profile.nozzle_notes ?? 'No special requirements'}`, `- Enclosure Needed: ${profile.enclosure_needed ? 'Yes' : 'No'}`, '', '## Usage', `- Typical Uses: ${profile.typical_uses}`, `- Pros: ${profile.pros}`, `- Cons: ${profile.cons}`, ]; return { content: [{ type: 'text' as const, text: lines.join('\n') }] }; }, ); } - src/data/db.ts:260-278 (schema)The MaterialProfileRow interface defining all fields returned for a material profile: temperature ranges, strength, flexibility, UV resistance, food safe, moisture sensitivity, difficulty, typical uses, pros/cons, nozzle notes, enclosure needed.
export interface MaterialProfileRow { id: number; material_name: string; print_temp_min: number | null; print_temp_max: number | null; bed_temp_min: number | null; bed_temp_max: number | null; strength: string; flexibility: string; uv_resistance: string; food_safe: string; moisture_sensitivity: string; difficulty: string; typical_uses: string; pros: string; cons: string; nozzle_notes: string | null; enclosure_needed: number; } - src/data/db.ts:280-288 (helper)The database query helper 'getMaterialProfile' that executes SELECT * FROM material_profiles WHERE material_name = ? and returns the row or null.
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; } - src/server.ts:14-53 (registration)Registration of the tool: import of registerGetMaterialProfile at line 14 and invocation at line 47 in createServer().
import { registerGetMaterialProfile } from './tools/get-material-profile.js'; import { registerCompareMaterials } from './tools/compare-materials.js'; import { registerRecommendMaterial } from './tools/recommend-material.js'; import { registerDiagnosePrintIssue } from './tools/diagnose-print-issue.js'; export interface ServerOptions { dbPath?: string; db?: import('better-sqlite3').Database; } export function createServer(options?: ServerOptions): McpServer { const __dirname = path.dirname(fileURLToPath(import.meta.url)); let version = '0.0.0'; try { const pkg = JSON.parse( readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'), ); version = pkg.version; } catch { // Fallback version if package.json not found (e.g., in tests) } const server = new McpServer({ name: '3dprint-oracle', version, }); const db = options?.db ?? getDatabase(options?.dbPath); registerSearchFilaments(server, db); registerGetFilament(server, db); registerListManufacturers(server, db); registerListMaterials(server, db); registerGetMaterialProfile(server, db); registerCompareMaterials(server, db); registerRecommendMaterial(server, db); registerDiagnosePrintIssue(server, db); return server; }