get_image_info
Extract metadata and technical details from image files to analyze dimensions, format, and properties for editing or processing workflows.
Instructions
Get metadata and information about an image
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputPath | Yes | Path to image file |
Implementation Reference
- src/index.ts:366-391 (handler)Handler implementation for the 'get_image_info' tool. Extracts image metadata using Sharp and file system stats, returns formatted JSON with image properties.
case 'get_image_info': { const { inputPath } = args; const metadata = await sharp(inputPath).metadata(); const stats = await fs.stat(inputPath); return { content: [ { type: 'text', text: JSON.stringify({ format: metadata.format, width: metadata.width, height: metadata.height, channels: metadata.channels, bitDepth: metadata.depth, colorSpace: metadata.space, density: metadata.density, hasAlpha: metadata.hasAlpha, fileSize: stats.size, lastModified: stats.mtime }, null, 2) } ] }; } - src/index.ts:158-164 (schema)Input schema definition for the 'get_image_info' tool, specifying the required inputPath parameter.
inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to image file' } }, required: ['inputPath'] } - src/index.ts:155-165 (registration)Registration of the 'get_image_info' tool in the ListTools response, including name, description, and input schema.
{ name: 'get_image_info', description: 'Get metadata and information about an image', inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to image file' } }, required: ['inputPath'] } },