List Manufacturers
list_manufacturersRetrieve a list of filament manufacturers with their filament counts, optionally filtered by material type like PLA or PETG.
Instructions
List all filament manufacturers in the database, with filament counts. Optionally filter to manufacturers that produce a specific material type.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| material | No | Filter to manufacturers that produce this material type (e.g., "PLA", "PETG") |
Implementation Reference
- src/tools/list-manufacturers.ts:25-49 (handler)The handler callback for the 'list_manufacturers' tool. Accepts an optional 'material' input, calls listManufacturers(db, material), formats results as a markdown table, and returns them as text content.
async ({ material }) => { const manufacturers = listManufacturers(db, material); const lines: string[] = []; if (material) { lines.push( `${manufacturers.length} manufacturer${manufacturers.length === 1 ? '' : 's'} producing ${material}:\n`, ); } else { lines.push( `${manufacturers.length} manufacturer${manufacturers.length === 1 ? '' : 's'}:\n`, ); } lines.push('| Manufacturer | Filaments |'); lines.push('|---|---|'); for (const m of manufacturers) { lines.push(`| ${m.name} | ${m.filament_count} |`); } return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, ); - Input schema for 'list_manufacturers': optional 'material' string to filter manufacturers by material type.
{ title: 'List Manufacturers', description: 'List all filament manufacturers in the database, with filament counts. Optionally filter to manufacturers that produce a specific material type.', inputSchema: { material: z .string() .optional() .describe( 'Filter to manufacturers that produce this material type (e.g., "PLA", "PETG")', ), }, - src/tools/list-manufacturers.ts:6-49 (registration)Function 'registerListManufacturers' that registers the tool with the McpServer under the name 'list_manufacturers'.
export function registerListManufacturers( server: McpServer, db: Database.Database, ): void { server.registerTool( 'list_manufacturers', { title: 'List Manufacturers', description: 'List all filament manufacturers in the database, with filament counts. Optionally filter to manufacturers that produce a specific material type.', inputSchema: { material: z .string() .optional() .describe( 'Filter to manufacturers that produce this material type (e.g., "PLA", "PETG")', ), }, }, async ({ material }) => { const manufacturers = listManufacturers(db, material); const lines: string[] = []; if (material) { lines.push( `${manufacturers.length} manufacturer${manufacturers.length === 1 ? '' : 's'} producing ${material}:\n`, ); } else { lines.push( `${manufacturers.length} manufacturer${manufacturers.length === 1 ? '' : 's'}:\n`, ); } lines.push('| Manufacturer | Filaments |'); lines.push('|---|---|'); for (const m of manufacturers) { lines.push(`| ${m.name} | ${m.filament_count} |`); } return { content: [{ type: 'text' as const, text: lines.join('\n') }], }; }, ); - src/server.ts:45-50 (registration)Registration call in the server: registerListManufacturers(server, db) wires the tool to the server.
registerListManufacturers(server, db); registerListMaterials(server, db); registerGetMaterialProfile(server, db); registerCompareMaterials(server, db); registerRecommendMaterial(server, db); registerDiagnosePrintIssue(server, db); - src/data/db.ts:204-237 (helper)The 'listManufacturers' helper function that queries the database (with optional material filter) and returns ManufacturerRow[]. Also shows the ManufacturerRow interface.
export interface ManufacturerRow { id: number; name: string; website: string | null; country: string | null; filament_count: number; } export function listManufacturers( db: Database.Database, materialFilter?: string, ): ManufacturerRow[] { if (materialFilter) { return db .prepare( `SELECT m.*, COUNT(f.id) AS filament_count FROM manufacturers m JOIN filaments f ON f.manufacturer_id = m.id WHERE f.material_name = ? GROUP BY m.id ORDER BY m.name`, ) .all(materialFilter) as ManufacturerRow[]; } return db .prepare( `SELECT m.*, COUNT(f.id) AS filament_count FROM manufacturers m JOIN filaments f ON f.manufacturer_id = m.id GROUP BY m.id ORDER BY m.name`, ) .all() as ManufacturerRow[]; }