Skip to main content
Glama

HeatShield: Geospatial MCP Agent

HeatShield is an AI-powered urban heat wave safety assistant designed to demonstrate the power of the Model Context Protocol (MCP) in grounding LLM agents with reliable, deterministic geospatial data.

The Problem with LLM "Freehanding" Spatial Data

When tasked with geospatial routing, weather analysis, or urban heat island (UHI) mapping, native LLMs suffer from severe hallucinations. They invent streets that don't exist, guess walking distances, and fabricate localized temperatures.

HeatShield solves this by entirely decoupling the intelligence layer from the data layer via MCP. Instead of the LLM generating markdown tables or estimating distances, it acts purely as a reasoning engine that orchestrates exact tool calls to deterministic APIs.

Related MCP server: OpenStreetMap MCP Server

Architecture & MCP Implementation

The core of HeatShield is an architecture where the LLM is tightly constrained to use server-side tools. The UI is designed for rapid prototyping, but the true value lies in the backend tool implementation.

Key MCP Tools Built for this Agent:

  • geocode_location: Resolves human-readable addresses to exact lat/lon coordinates via Nominatim.

  • find_cooling_spots: Queries the Overpass API for real-world infrastructure (parks, water fountains, cooling centers) based on the user's localized coordinates.

  • get_walking_route: Uses OSRM to calculate true walking distances and times, preventing the LLM from relying on "crow-flies" haversine estimations.

  • generate_walkability_isochrone: Generates an exact 15-minute reachable area polygon (GeoJSON).

  • get_urban_heat_island_heatmap: Pulls UHI surface temperature data to render deterministic heat blobs on the map.

  • get_occupational_heat_guidance: Calculates CDC/NIOSH work/rest cycles based strictly on current local wet-bulb globe temperature (WBGT) data.

How it Works

  1. User asks a question (e.g. "Find a cool place nearby").

  2. LLM reasons and calls tools. It executes find_cooling_spots passing the user's localized coordinates.

  3. MCP Server executes the query, fetching deterministic JSON data from Overpass.

  4. FastAPI intercepts the JSON payload. Instead of letting the LLM hallucinate prose about the data, FastAPI intercepts the structured GeoJSON and streams it directly to the React frontend.

  5. React Frontend renders natively. The UI renders the map pins and walking routes using standard Leaflet/React layers, bypassing LLM generation completely.

This architecture ensures that a user never receives a hallucinated safety route during an extreme weather event.

Tech Stack

  • Backend: FastAPI (Python), Model Context Protocol (MCP), Uvicorn, SQLite/DuckDB (Spatial Caching).

  • Frontend: React, Vite, React-Leaflet.

  • External Integrations: Overpass API, Open-Meteo, OSRM.

Setup & Running Locally

  1. Clone the repository.

  2. Install Python dependencies: uv sync

  3. Install Frontend dependencies: cd frontend && npm install

  4. Start the backend: uv run uvicorn api:app --reload

  5. Start the frontend: cd frontend && npm run dev

Available Tools

6 tools
find_cooling_spotsA

Use spatial analytics to find nearby cooling shelters (parks, pools, libraries, fountains). Requires latitude, longitude, and an optional radius in meters.

ParametersJSON Schema
NameRequiredDescriptionDefault
radiusNo
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does explain that the search is spatial ('spatial analytics') and requires coordinates and a radius, but it does not disclose any limitations, accuracy considerations, or what the output list might contain beyond the tool name. This is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences, front-loaded with the tool's purpose, then covering parameter requirements. Every sentence contributes meaningful information with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple spatial lookup with an output schema present, the description provides sufficient context: what it finds, the required inputs, and the optional parameter. It does not need to explain return values because the output schema exists. It lacks alternative tool guidance, but that is covered under usage guidelines.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does by explicitly naming all three parameters: latitude, longitude, and optional radius in meters. This adds meaning beyond the schema's bare type definitions, though it does not specify coordinate format or radius bounds.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function (find nearby cooling shelters) with specific verb and resource, and lists examples (parks, pools, libraries, fountains). This distinguishes it from siblings like get_weather_and_heat_risk or get_heat_safety_advice, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly indicates when to use the tool: when you need nearby cooling shelters. It also states the required inputs (latitude, longitude) and optional radius. However, it does not explicitly mention when not to use it or alternative tools, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

geocode_locationA

Get the latitude and longitude for a city, address, or location. Always use this tool first if you only have a city name and need coordinates for the other tools.

Args: query: The name of the city or location (e.g., "Karlsruhe, Germany")

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It explains the core behavior (returning coordinates) and implies a sequencing behavior ('use first'), but lacks details on edge cases like failed lookups, multiple results, or geographic restrictions. This is minimal but not misleading.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, with two sentences front-loaded with purpose and usage. The Args section is tightly integrated and adds value without redundancy. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's single parameter and existing output schema, the description adequately covers what an agent needs: purpose, usage timing, and parameter semantics. It doesn't explain the return format, but the output schema does, so that's not required. Minor gaps around error behavior are acceptable for a simple tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides no description for the 'query' parameter (0% coverage), but the description compensates with an explicit explanation and example: 'The name of the city or location (e.g., "Karlsruhe, Germany")'. This adds meaning and usage guidance that the schema alone lacks.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Get the latitude and longitude for a city, address, or location.' This is a specific verb and resource, and it distinctly separates this tool from its location-based siblings like weather, air quality, and cooling spots.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The instruction 'Always use this tool first if you only have a city name and need coordinates for the other tools' provides clear context for when to invoke this tool. It implies that this is a prerequisite for other tools, though it does not explicitly list when not to use it or name alternative tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_air_qualityA

Fetch live air quality data (PM2.5, PM10, AQI) to assess respiratory safety during heat waves. Requires latitude and longitude.

ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description must disclose behavioral traits. It mentions 'live' and that it requires latitude/longitude (already in schema), but does not disclose limitations, units, error behavior, or any safety/read-only nature beyond the verb 'Fetch' implying a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with the core action and data details. Every word is purposeful; no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and an output schema exists, but the description lacks any caution or usage exclusions. It states a use case but not coverage area, data source, or any complementary relationships with sibling tools, making it only minimally complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, but it only repeats 'Requires latitude and longitude' without adding meaning like units, coordinate order, or bounds. This adds no value beyond the schema's required fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the verb 'Fetch' and specific resource 'live air quality data (PM2.5, PM10, AQI)' with an intended use case. This distinguishes it from siblings which focus on weather, cooling spots, or heat risk/advice.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context: used to assess respiratory safety during heat waves. However, it does not explicitly mention alternatives or when not to use, falling just short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_heat_safety_adviceA

Get WHO/CDC safety recommendations based on the current heat risk level and the user's activity.

Args: heat_risk_level: Must be LOW, MODERATE, HIGH, or EXTREME (obtained from get_weather_and_heat_risk) activity_type: e.g., "jogging", "construction work", "elderly care", "general"

ParametersJSON Schema
NameRequiredDescriptionDefault
activity_typeYes
heat_risk_levelYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It discloses the valid values for heat_risk_level (LOW, MODERATE, HIGH, EXTREME) and its source, which is valuable context. It doesn't describe output format, but the output schema exists to cover that. No contradictions found.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise: two sentences plus a brief Args section. It front-loads the purpose and keeps parameter details in a structured list. Every sentence earns its place with no redundant content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter tool with an output schema, the description is complete. It states the purpose, defines both parameters with valid values/context, and notes the data dependency. There are no gaps that would prevent an agent from invoking the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema is sparse (0% coverage), but the description compensates thoroughly. It defines heat_risk_level with explicit allowed values and activity_type with examples ('jogging', 'construction work', 'elderly care', 'general'), giving an agent enough information to choose appropriate inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get'), the resource ('WHO/CDC safety recommendations'), and the condition ('based on the current heat risk level and the user's activity'). It distinguishes the tool from siblings like geocode_location, get_weather_and_heat_risk, and find_cooling_spots by focusing on safety advice rather than location or environmental data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly mentions that heat_risk_level is 'obtained from get_weather_and_heat_risk', providing clear guidance on when to use this tool (after fetching the heat risk). It doesn't explicitly state when not to use it or name alternatives, but the dependency implies the correct sequencing and purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_heatwave_forecastB

Fetches a 7-day weather forecast and calculates a Climate Aggravation Risk by correlating high temperatures with drought/soil moisture conditions. Use this to predict upcoming heatwaves and warn the user.

ParametersJSON Schema
NameRequiredDescriptionDefault
daysNo
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It discloses the core calculation logic (correlating high temps with drought/soil moisture) but inaccurately states a fixed 7-day forecast despite the schema allowing a configurable 'days' parameter, and it does not mention any limitations or prerequisites.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with no filler; it front-loads the primary action and adds a practical use case. Both sentences earn their place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers what the tool does and when to use it, but it omits the configurability of the forecast length and does not clarify its relationship to the sibling tool get_weather_and_heat_risk. The presence of an output schema partially compensates for not describing the return format, but overall it leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, and the description does not explain the latitude/longitude/days parameters. It only mentions '7-day', which hints at the days parameter but does not indicate that it is adjustable or clarify the coordinate requirements.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool fetches a 7-day weather forecast and calculates a Climate Aggravation Risk, with a specific use case ('predict upcoming heatwaves'). It lacks an explicit differentiation from the sibling tool get_weather_and_heat_risk, whose name suggests overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear usage context ('Use this to predict upcoming heatwaves and warn the user'), but does not mention alternatives or exclusions, such as when to prefer get_weather_and_heat_risk or other tools. This fits the 'clear context, no exclusions' level.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_weather_and_heat_riskB

Fetch live weather data (temperature, humidity, UV index) and a calculated WHO/CDC heat risk level. Requires latitude and longitude.

ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It only states the coordinate requirement (already present in the schema) and does not disclose read-only status, rate limits, error behavior, or other operational details. 'Fetch' implies a read operation but lacks explicit safety disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loaded with the main verb 'Fetch', and every word contributes to either purpose or prerequisites. No redundant or extraneous information is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and the description covers its core purpose and prerequisite. However, it lacks guidance on selecting this tool over siblings such as get_heatwave_forecast, and does not address potential limitations or error scenarios. Since an output schema exists, return details are not needed, but the sibling differentiation gap remains.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It merely repeats that latitude and longitude are required without explaining units, ranges, or format. The parameter names are self-explanatory, but the description adds minimal value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool fetches live weather data (temperature, humidity, UV index) and a calculated WHO/CDC heat risk level. The specific verb 'Fetch' and resource combination distinguish it from siblings like get_air_quality and get_heatwave_forecast.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the requirement for latitude and longitude but does not explicitly state when to use this tool versus alternatives like get_heatwave_forecast. The word 'live' implies current conditions, but no clear when-to-use or exclusion guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 6 tool updatesv0.1.0
    • First observedfind_cooling_spots
    • First observedgeocode_location
    • First observedget_air_quality
    • First observedget_heat_safety_advice
    • First observedget_heatwave_forecast
    • First observedget_weather_and_heat_risk

TDQS

A4.1/5.0

Scored across 6 tools

Disambiguation5/5

Each tool targets a distinct function: geocoding, current heat risk, air quality, cooling spots, safety advice, and heatwave forecast. There is no overlap that would confuse an agent's selection.

Naming Consistency5/5

All tools follow a clear verb_noun pattern (geocode_location, get_weather_and_heat_risk, get_air_quality, find_cooling_spots, get_heat_safety_advice, get_heatwave_forecast). The verbs (geocode, get, find) are appropriate and consistently placed.

Tool Count5/5

With 6 tools, the server is well-scoped for a heat health domain. Each tool provides essential functionality without redundancy or bloat, making the set easy to navigate.

Completeness5/5

The tool set covers the full user workflow: location to coordinates, current heat risk, air quality, cooling shelter discovery, safety advice, and upcoming heatwave prediction. No obvious gaps exist for typical heat safety use cases.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables AI agents to fetch real-time weather data for any location using the OpenWeatherMap API. Demonstrates how to build a simple MCP server that exposes weather information as a tool for LLMs.
    1
    GPL 3.0
  • A
    license
    B
    quality
    D
    maintenance
    A comprehensive MCP server providing 30 tools for geocoding, routing, and OpenStreetMap data analysis. It enables AI assistants to search for locations, calculate travel routes, and perform quality assurance checks on map data.
    30
    98 npm
    5
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants to call weather tools, read resources, and use prompt templates for live weather data integration.
    681 npm
    MIT