Skip to main content
Glama

gps-coordinates

Extract GPS coordinates (latitude and longitude) from image metadata to identify photo locations. Supports various image formats including paths, URLs, and encoded data.

Instructions

Extract GPS coordinates (latitude/longitude) from image metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYes

Implementation Reference

  • The handler function for the 'gps-coordinates' tool. It loads the image into a buffer using loadImage, extracts GPS data using exifr.gps(), and returns a standardized success response with the coordinates or null, or an error response.
    async (args, extra) => { try { const { image } = args; const buf = await loadImage(image); const gps = await exifr.gps(buf); return createSuccessResponse(gps || null); } catch (error) { return createErrorResponse(`Error reading GPS data: ${error instanceof Error ? error.message : String(error)}`); } }
  • Shared Zod schema defining the 'image' input parameter structure (ImageSourceType) used by the 'gps-coordinates' tool and others.
    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() });
  • Registration of the 'gps-coordinates' tool on the MCP server, including description, input schema reference, and handler function.
    // Tool 10: gps-coordinates - extracts GPS coordinates const gpsCoordinatesTool = server.tool('gps-coordinates', "Extract GPS coordinates (latitude/longitude) from image metadata", { image: ImageSourceSchema }, async (args, extra) => { try { const { image } = args; const buf = await loadImage(image); const gps = await exifr.gps(buf); return createSuccessResponse(gps || null); } catch (error) { return createErrorResponse(`Error reading GPS data: ${error instanceof Error ? error.message : String(error)}`); } } ); tools['gps-coordinates'] = gpsCoordinatesTool;

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