Skip to main content
Glama

get_weather_stats

Retrieve weather statistics, including current conditions, forecasts, and alerts, using simulated data from the Weather MCP Server.

Instructions

Get weather statistics information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP CallToolRequest handler case for 'get_weather_stats': calls weatherService.getWeatherStats() and returns JSON stringified response.
    case 'get_weather_stats': { const stats = await this.weatherService.getWeatherStats(); return { content: [ { type: 'text', text: JSON.stringify(stats, null, 2), }, ], }; }
  • Core handler function getWeatherStats() that computes weather statistics from mock data: total locations, avg temp, most common condition, and breakdown.
    async getWeatherStats(): Promise<{ totalLocations: number; averageTemperature: number; mostCommonCondition: string; locationBreakdown: Array<{location: string, temperature: number, condition: string}>; }> { const locations = Object.values(mockWeatherData); const totalLocations = locations.length; const averageTemperature = locations.reduce((sum, data) => sum + data.temperature, 0) / totalLocations; const conditionCounts: Record<string, number> = {}; locations.forEach(data => { conditionCounts[data.condition] = (conditionCounts[data.condition] || 0) + 1; }); const mostCommonCondition = Object.entries(conditionCounts) .reduce((a, b) => a[1] > b[1] ? a : b)[0]; const locationBreakdown = locations.map(data => ({ location: data.location, temperature: data.temperature, condition: data.condition })); return { totalLocations, averageTemperature: Math.round(averageTemperature * 10) / 10, mostCommonCondition, locationBreakdown }; }
  • src/index.ts:99-106 (registration)
    Tool registration in ListToolsRequest handler: defines name 'get_weather_stats', description, and empty input schema (no parameters).
    { name: 'get_weather_stats', description: 'Get weather statistics information', inputSchema: { type: 'object', properties: {}, }, },
  • Input schema for get_weather_stats tool: empty object properties (no input parameters required).
    inputSchema: { type: 'object', properties: {}, },

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/bobbyyng/weather-mcp-ts'

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