Skip to main content
Glama

get_weather

Retrieve real-time weather data for a specified location with customizable temperature units using this HTTP-based utility on the Simple HTTP MCP Server.

Instructions

Get the current weather in a given location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYesThe location to get the weather for
unitNoThe unit of temperaturecelsius

Implementation Reference

  • The main handler function that implements the logic for the 'get_weather' tool, which simulates returning weather data for a given location and unit.
    async def get_weather(args: Arguments[GetWeatherInput]) -> GetWeatherOutput: """Get the current weather in a given location.""" args.get_state_key("context", Context).add_called_tool("get_weather") return GetWeatherOutput( weather=f"The weather in {args.inputs.location} is 25 degrees {args.inputs.unit}", )
  • Pydantic input schema for the 'get_weather' tool defining location and unit parameters.
    class GetWeatherInput(BaseModel): location: str = Field(description="The location to get the weather for") unit: str = Field(description="The unit of temperature", default="celsius")
  • Pydantic output schema for the 'get_weather' tool defining the weather response.
    class GetWeatherOutput(BaseModel): weather: str = Field(description="The weather in the given location")
  • Registration of the 'get_weather' tool in the TOOLS tuple using the Tool constructor with handler, input schema, and output schema.
    func=get_weather, inputs=GetWeatherInput, output=GetWeatherOutput, ), Tool(

Other Tools

Related 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/yeison-liscano/http_mcp'

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