has_gps_exif
Check whether an image contains GPS or location EXIF fields. Determines if location data is embedded in the image's metadata.
Instructions
Check whether an image contains GPS/location EXIF fields.
This tool is read-only and must not modify the target file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image_path | Yes | ||
| has_gps | Yes | ||
| gps_fields_present | Yes |
Implementation Reference
- Core helper - loads EXIF and returns whether GPS fields are present
def detect_gps_exif(image_path: str) -> HasGpsExifResult: """Detect whether GPS EXIF fields are present on the image.""" normalized_path, exif_dict = _load_exif_dict(image_path) gps_fields_present = _gps_field_names(exif_dict) return { "image_path": str(normalized_path), "has_gps": bool(gps_fields_present), "gps_fields_present": gps_fields_present, } - TypedDict schema defining the return type of has_gps_exif
class HasGpsExifResult(TypedDict): """Contract for the has_gps_exif MCP tool.""" image_path: str has_gps: bool gps_fields_present: list[str] - Helper that extracts human-readable GPS field names from the EXIF GPS IFD
def _gps_field_names(exif_dict: dict[str, dict[int, Any]]) -> list[str]: """Return stable readable names for GPS fields present in EXIF metadata.""" gps_fields = [_tag_name("GPS", tag_id) for tag_id in exif_dict.get("GPS", {})] return sorted(gps_fields)