get_activity_weather
Retrieve weather conditions recorded during a Garmin activity, including temperature, humidity, wind speed, and condition description.
Instructions
Get weather conditions during an activity: temperature, humidity, wind, condition
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| activityId | Yes | The Garmin activity ID |
Implementation Reference
- src/tools/activities.tools.ts:111-124 (registration)Registration of the 'get_activity_weather' tool with the MCP server, including description, input schema, and handler function.
server.registerTool( 'get_activity_weather', { description: 'Get weather conditions during an activity: temperature, humidity, wind, condition', inputSchema: getActivitySchema.shape, }, async ({ activityId }) => { const data = await client.getActivityWeather(activityId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, ); - src/tools/activities.tools.ts:118-123 (handler)Handler function that calls client.getActivityWeather(activityId) and returns the result as JSON text.
async ({ activityId }) => { const data = await client.getActivityWeather(activityId); return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }], }; }, - src/dtos/activities.dto.ts:49-51 (schema)Input schema (Zod) for the tool: requires a positive numeric activityId.
export const getActivitySchema = z.object({ activityId: z.number().positive().describe('The Garmin activity ID'), }); - src/client/garmin.client.ts:235-237 (helper)Client method that constructs the request URL using ACTIVITY_ENDPOINT, activityId, and ACTIVITY_WEATHER_SUBPATH, then makes an authenticated API request.
async getActivityWeather(activityId: number): Promise<unknown> { return this.request(`${ACTIVITY_ENDPOINT}/${activityId}/${ACTIVITY_WEATHER_SUBPATH}`); } - Constant defining the weather subpath for activity-related API endpoints.
export const ACTIVITY_WEATHER_SUBPATH = 'weather';