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
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Partial city name, postcode, or coordinates to search. E.g. 'lond', 'SW1', 'paris'. |
Implementation Reference
- src/index.ts:327-331 (handler)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"], }, },