Skip to main content
Glama
Yarflam

Weather MCP Server

by Yarflam

search_cities

Find city coordinates by name to enable accurate weather data retrieval for specific locations.

Instructions

Recherche des villes par nom pour obtenir leurs coordonnées

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesNom de la ville à rechercher

Implementation Reference

  • Implementation of the search_cities tool handler. Fetches city search results from Open-Meteo geocoding API, formats up to 10 results with name, coordinates, admin1, country, population.
    async searchCities(query) {
      const url = `${GEOCODING_API}?name=${encodeURIComponent(query)}&count=10&language=fr&format=json`;
      
      const response = await fetch(url);
      const data = await response.json();
    
      if (!response.ok || !data.results) {
        throw new Error(`Aucune ville trouvée pour "${query}"`);
      }
    
      let resultText = `🔍 Villes trouvées pour "${query}":\n\n`;
      
      data.results.forEach((city, index) => {
        resultText += `${index + 1}. **${city.name}**\n`;
        resultText += `   📍 ${city.latitude}°, ${city.longitude}°\n`;
        if (city.admin1) resultText += `   🏛️ ${city.admin1}\n`;
        if (city.country) resultText += `   🌍 ${city.country}\n`;
        if (city.population) resultText += `   👥 ${city.population.toLocaleString()} habitants\n`;
        resultText += `\n`;
      });
    
      return {
        content: [
          {
            type: 'text',
            text: resultText.trim(),
          },
        ],
      };
    }
  • Tool schema definition in the ListTools response, including name, description, and input schema requiring a 'query' string.
    {
      name: 'search_cities',
      description: 'Recherche des villes par nom pour obtenir leurs coordonnées',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Nom de la ville à rechercher'
          }
        },
        required: ['query'],
      },
    },
  • src/index.js:159-160 (registration)
    Dispatch/registration of the tool handler in the CallToolRequestSchema switch statement.
    case 'search_cities':
      return await this.searchCities(args.query);
Behavior2/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. While it indicates this is a search operation that returns coordinates, it doesn't describe important behavioral aspects like whether this is a read-only operation, what format the coordinates are returned in, whether there are rate limits, how partial matches are handled, or what happens when no cities are found. The description provides basic functionality but lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in French that clearly states the tool's purpose. It's appropriately concise without being overly brief, though it could potentially be more front-loaded with additional context about when to use the tool. There's no wasted language or redundancy.

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?

For a search tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what format the coordinates are returned in (latitude/longitude pairs, geojson, etc.), whether results are paginated, how many results are returned, or what happens with ambiguous queries. The description provides basic functionality but leaves too many operational questions unanswered for effective 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 description mentions searching by city name, which aligns with the single 'query' parameter in the schema. Since schema description coverage is 100% and the schema already documents the parameter as 'Nom de la ville à rechercher' (Name of the city to search for), the description adds minimal value beyond what's already in the structured data. The baseline score of 3 is appropriate when the 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: searching for cities by name to obtain their coordinates. It specifies both the verb ('search') and resource ('cities'), and indicates the outcome ('obtain coordinates'). However, it doesn't explicitly differentiate from sibling tools like get_current_weather, which are weather-related rather than city search tools.

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_current_weather or explain that this tool is for finding city coordinates rather than weather data. There's no information about prerequisites, limitations, or appropriate contexts for use.

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/Yarflam/weather-mcp-server'

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