Skip to main content
Glama
prsantos-com

AirNow MCP Server

by prsantos-com

get-current-observations-by-reporting-area-by-lat-long

Retrieve current Air Quality Index (AQI) values and categories for a specific location using latitude and longitude. Supports multiple output formats and includes nearby reporting area data if necessary.

Instructions

Get current AQI values and categories for a reporting area by latitude and longitude.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
distanceNoIf no reporting area is associated with the latitude and longitude, current observations from a nearby reporting area within this distance (in miles) will be returned, if available. Example: 150
formatYesFormat of the payload file returned. Example: application/json
latitudeYesLatitude in decimal degrees. Example: 38.33
longitudeYesLongitude in decimal degrees. Example: -122.28

Implementation Reference

  • The MCP tool handler function that fetches data using the AirNow API helper and returns it as text content or an error message.
    async (params) => {
      const result =
        await airnowApi.fetchCurrentObservationsByReportingAreaByLatLong(
          params
        );
      if (result === null) {
        return {
          content: [
            {
              type: "text",
              text: "Failed to fetch current observations data from AirNow API.",
            },
          ],
          isError: true,
        };
      }
      return {
        content: [
          {
            type: "text",
            text: result,
          },
        ],
      };
    }
  • Zod schema for tool input parameters: latitude, longitude, format, and optional distance.
    {
      latitude: z
        .string()
        .describe("Latitude in decimal degrees. Example: 38.33"),
      longitude: z
        .string()
        .describe("Longitude in decimal degrees. Example: -122.28"),
      format: z
        .enum(["text/csv", "application/json", "application/xml"])
        .describe(
          "Format of the payload file returned. Example: application/json"
        ),
      distance: z
        .string()
        .optional()
        .describe(
          "If no reporting area is associated with the latitude and longitude, current observations from a nearby reporting area within this distance (in miles) will be returned, if available. Example: 150"
        ),
    },
  • The server.tool call that registers the tool, including name, description, input schema, and handler function.
    server.tool(
      "get-current-observations-by-reporting-area-by-lat-long",
      "Get current AQI values and categories for a reporting area by latitude and longitude.",
      {
        latitude: z
          .string()
          .describe("Latitude in decimal degrees. Example: 38.33"),
        longitude: z
          .string()
          .describe("Longitude in decimal degrees. Example: -122.28"),
        format: z
          .enum(["text/csv", "application/json", "application/xml"])
          .describe(
            "Format of the payload file returned. Example: application/json"
          ),
        distance: z
          .string()
          .optional()
          .describe(
            "If no reporting area is associated with the latitude and longitude, current observations from a nearby reporting area within this distance (in miles) will be returned, if available. Example: 150"
          ),
      },
      async (params) => {
        const result =
          await airnowApi.fetchCurrentObservationsByReportingAreaByLatLong(
            params
          );
        if (result === null) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to fetch current observations data from AirNow API.",
              },
            ],
            isError: true,
          };
        }
        return {
          content: [
            {
              type: "text",
              text: result,
            },
          ],
        };
      }
    );
  • Helper function that constructs the API request to AirNow's current observations endpoint by lat/long and calls the generic airnowGet fetcher.
    export async function fetchCurrentObservationsByReportingAreaByLatLong(params: Record<string, string>): Promise<string | null> {
      const endpoint = 'aq/observation/latlong/current/';
      const queryParams = new URLSearchParams();
      queryParams.append('latitude', params.latitude);
      queryParams.append('longitude', params.longitude);
      queryParams.append('format', params.format);
      if (params.distance) queryParams.append('distance', params.distance);
    
      return airnowGet(endpoint, queryParams);
    }
  • Invocation of the tool registration function within the central registerTools function.
    registerCurrentObservationsByLatLong(server);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool returns ('current AQI values and categories') but lacks critical behavioral details: it doesn't mention error handling (e.g., what happens if no reporting area is found), rate limits, authentication needs, or response format implications. The 'distance' parameter description in the schema hints at fallback behavior, but the tool description itself doesn't disclose this.

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 a single, efficient sentence that front-loads the core purpose. Every word earns its place with no redundancy or unnecessary elaboration. It's appropriately sized for a straightforward lookup tool.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'AQI values and categories' means, the structure of returned data, or error conditions. For a tool with 4 parameters and no structured output documentation, more context about behavior and results is needed.

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

Parameters3/5

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

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no parameter-specific information beyond implying latitude/longitude are required inputs. It doesn't explain parameter interactions, default values, or provide examples beyond what's in the schema. Baseline 3 is appropriate when schema does the heavy lifting.

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's purpose: 'Get current AQI values and categories for a reporting area by latitude and longitude.' It specifies the verb ('Get'), resource ('current AQI values and categories'), and key input method ('by latitude and longitude'). However, it doesn't explicitly differentiate from siblings like 'get-current-observations-by-reporting-area-by-zip-code' beyond the input method difference.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get-forecast-by-lat-long' for forecasts or 'get-historical-observations-by-reporting-area-by-lat-long' for historical data. There's no context about use cases, prerequisites, or exclusions.

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

Install Server

Other Tools

Related Tools

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/prsantos-com/airnow-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server