get_filament
Retrieve detailed specifications for 3D printing filaments including temperatures, density, weight, colors, and manufacturer information by ID or exact name.
Instructions
Get detailed information about a specific filament by ID or exact name. Returns full specs: temperatures, density, weight, colors, and manufacturer details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Filament ID | |
| name | No | Exact filament name |
Implementation Reference
- src/tools/get-filament.ts:70-106 (handler)The handler function for 'get_filament' tool, which processes input and fetches filament data.
async ({ id, name }) => { let filament: FilamentRow | null = null; if (id != null) { filament = getFilamentById(db, id); } else if (name != null) { filament = getFilamentByName(db, name); } else { return { isError: true, content: [ { type: 'text' as const, text: 'Please provide either an id or name. Use search_filaments to find filaments first.', }, ], }; } if (!filament) { return { isError: true, content: [ { type: 'text' as const, text: `Filament not found. Try using search_filaments to find the correct name or ID.`, }, ], }; } return { content: [ { type: 'text' as const, text: formatFilamentDetail(filament) }, ], }; }, - src/tools/get-filament.ts:65-68 (schema)The Zod-based input schema for the 'get_filament' tool.
inputSchema: { id: z.number().optional().describe('Filament ID'), name: z.string().optional().describe('Exact filament name'), }, - src/tools/get-filament.ts:55-108 (registration)The registration function that exposes 'get_filament' tool to the MCP server.
export function registerGetFilament( server: McpServer, db: Database.Database, ): void { server.registerTool( 'get_filament', { title: 'Get Filament', description: 'Get detailed information about a specific filament by ID or exact name. Returns full specs: temperatures, density, weight, colors, and manufacturer details.', inputSchema: { id: z.number().optional().describe('Filament ID'), name: z.string().optional().describe('Exact filament name'), }, }, async ({ id, name }) => { let filament: FilamentRow | null = null; if (id != null) { filament = getFilamentById(db, id); } else if (name != null) { filament = getFilamentByName(db, name); } else { return { isError: true, content: [ { type: 'text' as const, text: 'Please provide either an id or name. Use search_filaments to find filaments first.', }, ], }; } if (!filament) { return { isError: true, content: [ { type: 'text' as const, text: `Filament not found. Try using search_filaments to find the correct name or ID.`, }, ], }; } return { content: [ { type: 'text' as const, text: formatFilamentDetail(filament) }, ], }; }, ); }