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"],
      },
    },
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 well by specifying what data is returned ('coordinates, region, country, and URL slug') and the format ('array of matching locations'), but doesn't mention important behavioral aspects like rate limits, authentication requirements, or error conditions that would be crucial for an agent.

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 perfectly structured with two sentences: the first states the core functionality and return data, the second provides practical use cases. Every word earns its place with zero redundancy or wasted space.

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 single-parameter search tool with no output schema, the description does well by specifying the return format and content. However, without annotations and with no output schema, it could benefit from more detail about response structure (e.g., pagination, error cases) to be fully complete for agent use.

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?

The schema description coverage is 100%, so the input schema already documents the single parameter thoroughly. The description adds marginal value by mentioning 'partial name or postcode' and providing usage examples, but doesn't significantly enhance understanding beyond what the schema provides.

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 specific action ('Search for cities and towns'), the resource ('locations'), and the method ('by partial name or postcode'). It distinguishes this tool from siblings like weather or timezone tools by focusing on geographic lookup rather than meteorological or temporal 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 provides clear context about when to use this tool ('useful for building location pickers or resolving ambiguous place names'), giving practical application scenarios. However, it doesn't explicitly state when NOT to use it or mention specific alternatives among the sibling tools.

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

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