get_image_info
Extract metadata and key details from image files including format, dimensions, and properties. Use this tool to quickly retrieve essential image information for analysis or processing workflows.
Instructions
Get metadata and information about an image
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputPath | Yes | Path to image file |
Implementation Reference
- src/index.ts:366-391 (handler)Handler for the 'get_image_info' tool. Uses Sharp's metadata() method to extract image properties (format, dimensions, channels, etc.) and fs.stat() for file size and modification time. Returns a JSON-formatted text response with the information.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 for the 'get_image_info' tool, requiring a single 'inputPath' string 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 tools list returned by the ListToolsRequestSchema handler.{ 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'] } },