get-contour-maps-by-geographic-bounding-box-ozone
Access current or historical ozone contour maps by defining a geographic bounding box. Enter date, area coordinates, and coordinate system to retrieve KML-formatted data for air quality analysis.
Instructions
Get current or historical Ozone contour maps in KML by geographic bounding box.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | Yes | Geographic bounding box of the area of interest in latitude and longitude. Format: minX,minY,maxX,maxY. Example: -118,34,-71,42 | |
| date | Yes | The date and hour of the data (in UTC). Time represents the beginning of the measurement period. Format: yyyy-mm-ddTHH. Example: January 1, 2012 at 1PM would be formatted as: 2012-01-01T13 and represents data measured between 1:00 PM-1:59 PM UTC | |
| srs | Yes | The coordinate system of the bounding box. Format: The well-known text or EPSG code. Default: EPSG:4326. Example: EPSG:4326 |
Implementation Reference
- The MCP tool handler function that invokes the AirNow API helper to fetch ozone contour maps and returns the KML content or an error message.async (params) => { const result = await airnowApi.fetchContourMapsByGeographicBoundingBoxOzone(params); if (result === null) { return { content: [ { type: "text", text: "Failed to fetch contour maps data from AirNow API.", }, ], isError: true, }; } return { content: [ { type: "text", text: result, }, ], }; }
- Zod schema defining the input parameters for the tool: date, bbox, and srs.{ date: z .string() .describe( "The date and hour of the data (in UTC). Time represents the beginning of the measurement period. Format: yyyy-mm-ddTHH. Example: January 1, 2012 at 1PM would be formatted as: 2012-01-01T13 and represents data measured between 1:00 PM-1:59 PM UTC" ), bbox: z .string() .describe( "Geographic bounding box of the area of interest in latitude and longitude. Format: minX,minY,maxX,maxY. Example: -118,34,-71,42" ), srs: z .string() .describe( "The coordinate system of the bounding box. Format: The well-known text or EPSG code. Default: EPSG:4326. Example: EPSG:4326" ), },
- The registration function that registers the MCP tool with the server, including name, description, schema, and handler.export const registerContourMapsByBoundingBoxOzone = (server: McpServer): void => { server.tool( "get-contour-maps-by-geographic-bounding-box-ozone", "Get current or historical Ozone contour maps in KML by geographic bounding box.", { date: z .string() .describe( "The date and hour of the data (in UTC). Time represents the beginning of the measurement period. Format: yyyy-mm-ddTHH. Example: January 1, 2012 at 1PM would be formatted as: 2012-01-01T13 and represents data measured between 1:00 PM-1:59 PM UTC" ), bbox: z .string() .describe( "Geographic bounding box of the area of interest in latitude and longitude. Format: minX,minY,maxX,maxY. Example: -118,34,-71,42" ), srs: z .string() .describe( "The coordinate system of the bounding box. Format: The well-known text or EPSG code. Default: EPSG:4326. Example: EPSG:4326" ), }, async (params) => { const result = await airnowApi.fetchContourMapsByGeographicBoundingBoxOzone(params); if (result === null) { return { content: [ { type: "text", text: "Failed to fetch contour maps data from AirNow API.", }, ], isError: true, }; } return { content: [ { type: "text", text: result, }, ], }; } ); };
- src/airnow-api.ts:114-122 (helper)Helper function that makes the HTTP request to the AirNow API ozone contour maps endpoint using the generic airnowGet function.export async function fetchContourMapsByGeographicBoundingBoxOzone(params: Record<string, string>): Promise<string | null> { const endpoint = 'aq/kml/ozone/'; const queryParams = new URLSearchParams(); queryParams.append('date', params.date); queryParams.append('bbox', params.bbox); queryParams.append('srs', params.srs || 'EPSG:4326'); return airnowGet(endpoint, queryParams); }