Skip to main content
Glama
Francis235
by Francis235

query_weather

Get current weather conditions for any city using AMap's location services. Provide a city name to receive weather data.

Instructions

The weather service of Amap. Query the weather of a given city.

Args:
    city (str): The city to query the weather.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes

Implementation Reference

  • MCP tool handler for 'query_weather'. Registered via @mcp.tool decorator, includes input schema description in Args, executes by delegating to AmapClient.async_query_weather.
    @mcp.tool(
        description="""The weather service of Amap. Query the weather of a given city.
        
        Args:
            city (str): The city to query the weather.
        """
    )
    async def query_weather(city: str):
        logger.info(f"query_weather is called.")
        return await async_client.async_query_weather(city)
  • Core asynchronous helper function in AmapQueryWeatherClient that performs the actual HTTP GET request to the Amap weather API endpoint.
    async def async_query_weather_impl(self, city: str):
        url = "https://restapi.amap.com/v3/weather/weatherInfo"
        request_data = {
            "city": city,
            "key": self.key
        }
        logger.info(f"request_data: {request_data}")
        try:
            response = await self.httpx_client.get(url, params=request_data)
            return response.json()
        except Exception as e:
            logger.error(f"error: {e}")
            raise e
  • AmapClient wrapper class that initializes and delegates to AmapQueryWeatherClient for query_weather functionality.
    from .query_weather.client import AmapQueryWeatherClient
    
    class AmapClient:
        def __init__(self, key: str, httpx_client: typing.Union[httpx.Client, httpx.AsyncClient]):
            self.key = key
            self.httpx_client = httpx_client
            self.query_weather_client = AmapQueryWeatherClient(key, httpx_client)
    
        def query_weather(self, city: str):
            return self.query_weather_client.query_weather_impl(city)
        
        async def async_query_weather(self, city: str):
            return await self.query_weather_client.async_query_weather_impl(city)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the service provider ('Amap') but fails to describe key traits such as rate limits, authentication needs, error handling, or what the response format looks like. For a query tool with zero annotation coverage, this is a significant gap in transparency.

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 appropriately sized and front-loaded, with the core purpose stated first followed by parameter details. Both sentences earn their place by providing essential information without redundancy. The structure is clear and efficient for a simple tool.

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

Completeness3/5

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

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate but lacks completeness. It covers the basic purpose and parameter but omits details on response format, error cases, and service constraints. For a query tool, this leaves gaps in understanding how to interpret results.

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

Parameters4/5

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

The description adds meaningful context for the single parameter 'city' by specifying it as 'The city to query the weather,' which clarifies its role beyond the schema's basic title. With 0% schema description coverage and only one parameter, this adequately compensates, though it could detail format expectations (e.g., city names, language).

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 as 'Query the weather of a given city,' specifying the verb 'query' and resource 'weather' with the target 'city.' It distinguishes the service provider as 'Amap,' but since there are no sibling tools, full differentiation isn't needed. However, it could be more specific about what weather data is returned.

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, prerequisites, or limitations. It only states the basic function without context about availability, accuracy, or when it might fail. With no sibling tools, explicit alternatives aren't required, but general usage context is missing.

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/Francis235/amap-mcp'

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