Skip to main content
Glama
sritajkumarpatel

Weather Service MCP

get_weather

Retrieve current weather conditions for any city or location using the Weather Service MCP tool. Provide a location name to get real-time weather data.

Instructions

Get the current weather for a given location.

Args: location: The name of the city or location to get weather for

Returns: A string describing the current weather conditions

Note: This is a mock implementation. In production, integrate with a real weather API like OpenWeatherMap, WeatherAPI, or similar services.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The get_weather tool handler function, decorated with @mcp.tool(). It takes a location string and returns mock weather data.
    @mcp.tool()
    def get_weather(location: str) -> str:
        """
        Get the current weather for a given location.
        
        Args:
            location: The name of the city or location to get weather for
            
        Returns:
            A string describing the current weather conditions
            
        Note:
            This is a mock implementation. In production, integrate with a real
            weather API like OpenWeatherMap, WeatherAPI, or similar services.
        """
        # In a real implementation, this function would call a weather API.
        return f"The current weather in {location} is sunny with a temperature of 25°C."

Tool Definition Quality

Score is being calculated. Check back soon.

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/sritajkumarpatel/learn_mcp_2025'

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