Skip to main content
Glama
geoagent-lebanon

geoagent-lebanon

GeoAgent-Lebanon

python dependencies license

A read-only, bilingual (Arabic–English) evidence agent for land-change screening in Lebanon.

GeoAgent-Lebanon exposes the evidence behind a Sentinel-2 land-change screening study as 30 read-only tools over the Model Context Protocol (MCP). A language-model assistant connected to the server answers questions in Arabic or English by calling the tools; every answer is read from saved result files and carries its caveats. The agent cannot create, change or delete a label.

This repository is the software companion to the Master's Project GeoAgent-Lebanon: Uncertainty-Aware, Label-Efficient Land-Change Screening and Prioritisation from Sentinel-2 Composites, with a Bilingual (Arabic–English) Evidence Agent (MSc Data Science, Lebanese American University).

What it does

Tool family

Tools

Evidence it reads

Data in this repository

AI-consensus reference and audit

11

200 stratified 420 m blocks (Beirut, Mount Lebanon), two AI annotation passes, a two-reviewer audit of 80 blocks

Included

Human reference

11

300 blocks labelled by two human reviewers with an adjudicator (kappa 0.65)

Not redistributed (see data availability)

Historical OpenStreetMap

8

Mapped building footprints in 2018, 2022 and 2025 for the 300 blocks

Not redistributed

When a restricted file is absent, its tools stay listed and return a structured, bilingual "dataset not available" answer instead of failing. The test suite exercises them on synthetic fixtures.

Related MCP server: yerevan-landuse-mcp

Design principles

  • Read-only. No tool writes anything; a test asserts that no write tool exists.

  • Evidence, not generation. Tools look up saved results. They do not run a model or reprocess imagery.

  • Caveats travel with the answer. Every response states its scope: a sample is not full coverage, an AI-consensus label is not human ground truth, a mapped footprint is not a physical building.

  • Bilingual by design. Place names, filter values and messages work natively in Arabic and English, with Arabic spelling and diacritic normalisation.

  • Auditable. Every call through the server or the command line can be logged to an append-only JSONL file.

  • No dependencies. The server, the command line and the tests use only the Python standard library.

Quick start

git clone https://github.com/Ramikhatib615/geoagent-lebanon.git
cd geoagent-lebanon

# list the 30 tools and their schemas (no language model needed)
python src/geoagent/tool_cli.py list

# call a tool
python src/geoagent/tool_cli.py audit_status "{}"
python src/geoagent/tool_cli.py block_evidence "{\"block_id\": \"E137\"}"
python src/geoagent/tool_cli.py change_summary "{\"place\": \"الضاحية\"}"

# run the tests (six suites, 69 tests)
for t in tests/test_*.py; do python "$t"; done

Python 3.9 or later. No installation step is required.

MCP client setup

Register the server in any MCP client that supports stdio servers:

{
  "mcpServers": {
    "geoagent-lebanon": {
      "command": "python",
      "args": ["/absolute/path/to/geoagent-lebanon/src/geoagent/mcp_server.py"]
    }
  }
}

A ready-to-copy file is in examples/mcp_client_config.json. Restart the client after changing the entry: a running server process keeps the tool list it started with. The server implements initialize, ping, tools/list and tools/call (protocol 2024-11-05; compatible with later clients).

Example questions

Question

Tool

How much changed area was estimated after the audit?

audit_status

What happened to blocks E137 and E199?

block_evidence

قديش المساحة المتغيّرة بعد التدقيق البشري؟

audit_status

وين لازم يروح الإنسان يراجع؟

uncertainty

Which reviewed blocks lie within 5 km of this point?

human_blocks_near

Is a block with no mapped footprint building-free?

osm_building_free_status

Can the data support a damage claim for this place?

damage_claim_check

More in examples/sample_queries.md and examples/sample_outputs.md. The full tool reference is in docs/mcp-tools.md.

Key audited results the agent reports

  • Audit of the AI labels. A two-reviewer audit of 80 blocks, conducted under a protocol that specified blinding, decided 75 blocks; the reviewers agreed on all 75, and 5 remain interpretation-sensitive.

  • Shared AI bias. Where the two AI passes agreed, the audit disagreed on 17.7% of blocks, against about 3% expected if their errors were independent.

  • Changed area. 56.6 km² (95% interval 29.7 to 87.9) after audit correction, down from 82.1 km².

  • Model ranking. The spectral score's lead over the random forest on the audited blocks is 0.13 AUC points with an interval spanning zero: reported as audit-sensitive, not as a confirmed result.

These are development results on a sample. See Limitations.

Repository layout

src/geoagent/      tool layer, MCP server, command line, audit log, QGIS panel logic
tests/             six test suites and synthetic fixtures
outputs/eval/      small derived reference and audit files used by the 11 AI-consensus tools
docs/              architecture, tool reference, audit methodology, data availability, GIS workflow
examples/          sample queries, recorded outputs, MCP client configuration

Limitations

  • The 200-block reference set is a stratified sample of two areas, not full coverage of any place.

  • AI-consensus labels are candidate reference labels. Only the 80 audited blocks carry a human label, and whether the reviewers could see the AI labels was not recorded at the time.

  • The 300 human-reviewed blocks are reference labels at moderate agreement, not ground truth; reviewer names, dates and blinding are only partly documented.

  • OpenStreetMap snapshots record what was mapped, not what existed. No building change is verified.

  • Every reported model figure is development evidence. No independent Lebanese test has been run.

  • The agent tests were written by the system's author and do not rank language models.

  • No satellite imagery is distributed here (see data/README.md).

Citation

If you use this software, please cite it using CITATION.cff:

El Khatib, R. (2026). GeoAgent-Lebanon: a bilingual, read-only evidence agent for land-change screening in Lebanon (version 0.5.0). Master's Project, MSc Data Science, Lebanese American University.

Licence and data credits

Code: MIT. Contains modified Copernicus Sentinel data (2018, 2025) in derived form only. Administrative boundaries: OCHA COD-AB Lebanon via HDX (CC BY-IGO). OpenStreetMap-derived statistics: © OpenStreetMap contributors (ODbL). Esri World Imagery was used only as a viewing aid during review and is not redistributed.

Available Tools

30 tools
area_estimateB

Design-weighted share of blocks with change in an AOI (beirut / mount_lebanon) and/or governorate with a stratified-bootstrap 95% interval.

Inputs: aoi, lang, governorate.

audit_statusB

Report the completed Appendix G two-reviewer human audit (protocol specified blinding): sample size, agreement, which blocks' final label differs from the AI-consensus label, the correlated-error test result, and the resulting audited re-analysis (headline AUC comparison and the recalibrated changed-area estimate). All values are read from the audit's own result files; nothing is recomputed.

Inputs: lang.

block_demoB

Defense-ready summary for one block id: AI-consensus label, human-audit label and agreement status if audited, why the block matters (e.g. E137/E199 as the two Rule 1 pivotal flips, or a still-contested block), which map(s) show it, its evidence-book image reference, a plain-language explanation, and caveats.

Inputs: block_id (required), lang.

block_evidenceB

Full evidence for one reference block id (E001..E200): location, annotators, adjudication, change type, human check, image sheet.

Inputs: block_id (required), lang.

blocks_nearB

Reference blocks whose centre lies within radius_km (default 1, max 50) of a WGS84 point, nearest first, with distances and label counts; optional label filter (English or Arabic). Sample blocks only.

Inputs: lat (required), lon (required), lang, label, +2 more.

building_footprint_evidenceB

OSM 2022 building count for a human-reviewed block with completeness warning; zero is not proof of absence.

Inputs: block_id (required), lang.

change_summaryA

Summarise the reference-block evidence of change between 2018 and 2025 for a place name (Arabic/English) or a block id. Returns raw counts, change types and caveats; never extrapolates to the whole place.

Inputs: place (required), lang.

compare_placesB

Compare the change evidence of two places side by side; refuses to rank when there are fewer than 5 blocks per place.

Inputs: place_a (required), place_b (required), lang.

damage_claim_checkC

Checks whether a damage claim can be supported by the project data (it cannot) and says what is needed.

Inputs: lang, place, block_id.

human_block_lookupA

Look up one HUMAN-reviewed block (of 300): human reference label, label class, reviewer agreement, model scores. Read-only. Not AI-consensus.

Inputs: block_id (required), lang.

human_blocks_nearB

Human-reviewed blocks within radius_km of a WGS84 point (validates Lebanon bounds), nearest first, with labels and classes.

Inputs: lat (required), lon (required), lang, label, +2 more.

human_dataset_scopeB

Scope, counts and limitations of the 300-block human reference set; states that no write tool exists.

Inputs: lang.

human_label_provenanceB

State who/what produced a human label and what is NOT documented (names, dates, blindness). Read-only.

Inputs: block_id (required), lang.

human_query_blocksA

Count human-reviewed blocks by governorate, label (change/no_change), label_class, OSM-zero flag and flagged-cadastral-unit membership, with optional group_by, and optional ranking (rank_by spectral score, DINOv2 score or 2022 OSM building count; top_n). Unweighted; read-only.

Inputs: lang, label, top_n, rank_by, +5 more.

human_regional_performanceA

AUROC of spectral and DINOv2 scores against human labels, nationwide or per governorate, with post hoc warnings; refuses when a class has fewer than 5 blocks. include_single_rater=false excludes the 13 single-rater labels.

Inputs: lang, governorate, include_single_rater.

human_reviewer_agreementB

Counts by label class (concordant / adjudicated / unresolved) and reported kappa, optionally per governorate.

Inputs: lang, governorate.

human_unresolvedB

List the 13 blocks the two-reviewer process could not resolve and their later single-rater labels, flagged as the weakest human class.

Inputs: lang, limit.

list_placesA

List named places (Arabic or English) that have reference blocks, with counts of blocks by label. Optional name filter and governorate.

Inputs: lang, limit, query, governorate.

map_catalogA

List the 5 static executive defense maps (PDF/PNG): title, local path, what each shows, its report section, when to open it in a defense, its talking point, and its caveat. Map files live in the full local project GIS bundle, not the packaged GitHub repo; exists is checked fresh on every call.

Inputs: lang.

model_vs_humanC

Compare spectral and DINOv2 score decisions with the human label for one block (percentile and prevalence-matched display rule).

Inputs: block_id (required), lang.

osm_block_historyB

Mapped OSM building history of one reviewed block (2018-09-15, 2025-09-15, 2022): counts, covered area, transition categories, with the mapping-vs-physical caveat. Read-only.

Inputs: block_id (required), lang.

osm_building_free_statusB

Status of a block with zero mapped footprints: never 'building-free' without imagery review. Read-only.

Inputs: block_id (required), lang.

osm_contradictionsB

Blocks where OSM evidence and the human label or model scores contradict each other. Read-only.

Inputs: n, lang.

osm_mapping_vs_physicalA

Explains why an OSM mapping change is not a physical building change and what evidence would be needed. Read-only.

Inputs: lang.

osm_physical_verificationA

Physical verification status of OSM building changes: always 'pending' (no dated imagery review exists). Read-only.

Inputs: lang, block_id.

osm_region_coverageB

Mapped-footprint counts and growth by governorate, 2018 vs 2025 (mapping imbalance, not construction). Read-only.

Inputs: lang.

osm_vs_scoresC

Blocks where the OSM change and the spectral score disagree. kind: osm_increase_low_spectral | high_spectral_no_osm_change.

Inputs: kind (required), n, lang.

osm_zero_footprint_summaryA

Counts of the 300 reviewed blocks with zero MAPPED OSM footprints in 2018, 2022, 2025 and in all three (optionally by governorate). Never 'building-free'. Read-only.

Inputs: lang, governorate.

query_blocksA

Count/list reference blocks matching ALL filters (aoi, governorate, label, change_type, stratum, place, label_source agreed|adjudicated, annotator_a, annotator_b, annotators_disagree, min/max_lat, min/max_lon of block centres); returns count, unweighted and design-weighted change share (uncertain excluded) and optional counts by group_by (label|change_type|stratum|aoi|governorate|place_en|label_source).

Inputs: aoi, lang, label, place, +12 more.

uncertaintyC

Deferral assessment: which blocks of a place / block id should be deferred to a human reviewer, and why; plus model-level conformal deferral rates.

Inputs: place (required), lang.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 30 tools

    Disambiguation3/5

    Several near-parallel pairs exist that an agent must disambiguate by fine print: query_blocks vs human_query_blocks, blocks_near vs human_blocks_near, block_evidence vs human_block_lookup vs block_demo, and a cluster of OSM tools (osm_building_free_status, osm_zero_footprint_summary, building_footprint_evidence, osm_physical_verification) that all restate the same 'zero/pending is not proof' caveat. Descriptions do distinguish them (reference blocks vs human-reviewed 300, evidence dump vs defense summary), but the boundaries are subtle enough that misselection is likely.

    Naming Consistency3/5

    All snake_case, but prefixing is inconsistent: domain-prefixed tools (human_*, osm_*, map_*, block_*) sit alongside unprefixed ones (query_blocks, blocks_near, uncertainty, change_summary, compare_places, area_estimate, audit_status) that belong to the same families. The result is readable but unpredictable — e.g. query_blocks has a human_ counterpart while blocks_near does not follow the same scheme for its human twin.

    Tool Count2/5

    30 tools for a read-only block-evidence dataset is heavy, and the count is inflated by pedantic explainer/caveat tools (osm_mapping_vs_physical, osm_physical_verification, damage_claim_check, human_label_provenance) that are documentation rather than operations. Much of this could collapse into a few parameterized query/evidence tools.

    Completeness4/5

    Coverage of the stated domain is strong: place listing, block evidence, filtered counting, proximity, area estimation, uncertainty/deferral, human audit, model comparison, OSM evidence, and map catalog all exist, and the absence of write tools is documented as intentional. Minor gaps remain (no explicit annotator/stratum or imagery-catalog listing, no export/serialization path), but agents can work around them.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      Provides tools to explore and analyze Yerevan land-use classifications across 2015, 2020, and 2024 using H3 hexagons, including class composition, transitions, and spatial queries. Enables users to retrieve hex details, compute change summaries, and export GeoJSON through natural language.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Gives AI assistants read-only, key-free access to Sentinel-2 NDVI time series, ESA WorldCover land-cover shares, and Copernicus 30 m elevation and slope for a point or small area, returning the scene IDs, units, and caveats behind every number. Built-in sanity checks and a verify tool recompute key values through an independent path so the assistant can flag cloudy, low-confidence, or mismatched results instead of guessing.
      6
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables reporters to ask plain-language questions of government open data on any Socrata portal — city, county, state, or federal — directly from MCP clients like Claude and ChatGPT. Every numeric answer is returned with its counting unit, completeness flag, reproducible query link, and a frozen evidence snapshot so figures can be audited.
      6
      MIT