brickognize_identify_part
Identify a specific LEGO part from a photograph by providing the image path. Returns matched parts with IDs, names, confidence scores, and links for accurate LEGO piece recognition.
Instructions
Identify a specific LEGO part/brick/element from a photograph. Use instead of brickognize_identify when you know the image shows a single LEGO piece for more accurate results.
Provide imagePath — absolute path to a local image file (JPEG, PNG, or WebP). Returns matched parts with IDs, names, confidence scores, and links.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| imagePath | No | Absolute path to a local image file (JPEG, PNG, or WebP). | |
| includeRaw | No | When true, includes the raw Brickognize API response alongside formatted results. Useful for debugging. |
Implementation Reference
- src/tools/predict.ts:7-53 (handler)The createPredictTool function is the handler that dynamically creates and registers the MCP tool. It uses the provided endpoint to call the Brickognize API and formats the result.
export function createPredictTool( server: McpServer, name: string, title: string, description: string, endpoint: string, ): void { server.registerTool( name, { title, description, inputSchema: imageInputSchema, annotations: TOOL_ANNOTATIONS, }, async (input) => { try { const { blob, filename } = await resolveImage(input); const raw = await predict(endpoint, blob, filename); const result = mapPredictionResult(raw, input.includeRaw ?? false); return { content: [ { type: "text" as const, text: result.summary, }, { type: "text" as const, text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: formatToolError(error), }, ], }; } }, ); } - src/tools/predictParts.ts:4-15 (registration)Registration of the 'brickognize_identify_part' tool using the createPredictTool helper.
export function registerIdentifyPartTool(server: McpServer): void { createPredictTool( server, "brickognize_identify_part", "Identify LEGO Part", "Identify a specific LEGO part/brick/element from a photograph. " + "Use instead of brickognize_identify when you know the image shows a single LEGO piece for more accurate results.\n\n" + "Provide imagePath — absolute path to a local image file (JPEG, PNG, or WebP).\n" + "Returns matched parts with IDs, names, confidence scores, and links.", "/predict/parts/", ); }