Skip to main content
Glama

search_locations

Find cities and towns by partial name or postcode to get coordinates, region, and country data for location selection in weather applications.

Instructions

Search for cities and towns by partial name or postcode. Returns an array of matching locations with their coordinates, region, country, and URL slug. Useful for building location pickers or resolving ambiguous place names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesPartial city name, postcode, or coordinates to search. E.g. 'lond', 'SW1', 'paris'.

Implementation Reference

  • The handler for search_locations, which invokes the weatherRequest utility with the /search.json endpoint.
    case "search_locations": {
      const { q } = args as { q: string };
      result = await weatherRequest("/search.json", { q });
      break;
    }
  • src/index.ts:211-224 (registration)
    The registration and schema definition for the search_locations tool within the listTools request handler.
      name: "search_locations",
      description:
        "Search for cities and towns by partial name or postcode. Returns an array of matching locations with their coordinates, region, country, and URL slug. Useful for building location pickers or resolving ambiguous place names.",
      inputSchema: {
        type: "object",
        properties: {
          q: {
            type: "string",
            description: "Partial city name, postcode, or coordinates to search. E.g. 'lond', 'SW1', 'paris'.",
          },
        },
        required: ["q"],
      },
    },

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/weatherapicom/weatherapi-mcp'

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