Skip to main content
Glama

read-exif

Extract EXIF metadata from images to access camera settings, location data, and timestamps for analysis or verification purposes.

Instructions

Read EXIF data from an image with optional tag filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes
pickNo

Implementation Reference

  • The handler function that loads the image buffer using loadImage, builds EXIF-specific parsing options with buildExifOptions, extracts metadata using exifr.parse, and returns a standardized success response with the EXIF data or an error response.
    async (args, extra) => { try { const { image, pick } = args; const buf = await loadImage(image); const opts = buildExifOptions(pick); const meta = await exifr.parse(buf, opts); if (!meta || Object.keys(meta).length === 0) { return createErrorResponse('No EXIF metadata found in image'); } return createSuccessResponse(meta); } catch (error) { return createErrorResponse(`Error reading EXIF data: ${error instanceof Error ? error.message : String(error)}`); } }
  • Shared Zod schema defining the input 'image' parameter structure, supporting different image source kinds: path, url, base64 data, or buffer.
    const ImageSourceSchema = z.object({ kind: z.enum(['path', 'url', 'base64', 'buffer']), path: z.string().optional(), url: z.string().optional(), data: z.string().optional(), buffer: z.string().optional() });
  • Registers the read-exif tool on the MCP server instance using server.tool(), providing name, description, input schema (image and optional pick), and the handler function; stores the tool reference in the tools object.
    // Tool 2: read-exif - reads EXIF data specifically const readExifTool = server.tool('read-exif', "Read EXIF data from an image with optional tag filtering", { image: ImageSourceSchema, pick: z.array(z.string()).optional() }, async (args, extra) => { try { const { image, pick } = args; const buf = await loadImage(image); const opts = buildExifOptions(pick); const meta = await exifr.parse(buf, opts); if (!meta || Object.keys(meta).length === 0) { return createErrorResponse('No EXIF metadata found in image'); } return createSuccessResponse(meta); } catch (error) { return createErrorResponse(`Error reading EXIF data: ${error instanceof Error ? error.message : String(error)}`); } } ); tools['read-exif'] = readExifTool;
  • Helper utility that constructs exifr parsing options specifically for the read-exif tool: enables TIFF (for EXIF), disables other segments, and includes optional specific tag picking.
    /** * Creates options object for the read-exif tool * @param pick Optional array of specific EXIF tags to pick * @returns Options object configured for EXIF reading */ export function buildExifOptions(pick?: string[]): ExifrOptions { return { tiff: true, xmp: false, icc: false, iptc: false, jfif: false, ihdr: false, ...(pick ? { pick } : {}) }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/stass/exif-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server