Change legs
leg_writeChange a trip's ordered legs: create, update, delete, reorder (a full leg-id permutation, reassigning seq 1..N), and fill a leg's wind from a weather service (fetch_weather). A leg backed by a track (statsSource: 'track') rejects an update that touches any computed stats/coordinate/time field with a stats_readonly error — its startName/endName/notes stay editable regardless. The weather fields are hand-entered observations, except the wind pair when weatherSource is 'open_meteo': windSpeedKn is true wind speed in knots, windDirDeg an integer 0-359 in meteorological convention (the direction the wind blows FROM), seaState the Douglas degree of sea 0-9. They stay editable on EVERY leg, track-backed or not, because no GPX file records them. fetch_weather fills the leg's WIND (speed and direction, never sea state) from the free Open-Meteo service: it resolves the position and time window from the leg's own data (its track's middle point, else its endpoint midpoint, else its start) and stores the arithmetic mean of the hourly speeds over that window plus their SPEED-WEIGHTED circular mean direction, stamping weatherSource 'open_meteo' and weatherFetchedAt — except when the window was a dead calm, which yields no direction: a hand-entered windDirDeg then survives and the response says weatherSource 'manual' instead, because the stamp must never attribute a hand-typed value to the provider. This is the ONLY action that makes an outbound network call on the caller's behalf, it is rate-limited to 30 per hour per user, and it overwrites whatever wind the leg already had, hand-entered included. A later hand-edit of either WIND field flips weatherSource back to 'manual' and clears weatherFetchedAt; writing seaState does NOT, because the pair records where the wind came from and sea state is never fetched. A leg with no usable coordinates or no usable time window is weather_no_position (422); an upstream failure or a date the provider does not cover is weather_unavailable (503). IDs are 6-character case-sensitive alphanumeric strings. Timestamps are UTC ISO 8601. Distances are integer meters. Durations are integer seconds.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||