latest_prices: add include_expired passthrough for historical data
ag-monitor now drops expired delivery months from /api/data/latest by default (current + future only). Expose the opt-in through the MCP so the advisor can fetch past months when a farmer explicitly asks for history, while the default stays current + future. - client.latest(include_expired=False): forwards include_expired=true only when set (None is dropped), so the default query string is unchanged. - latest_prices tool: new include_expired arg with a description steering the model to set it only on an explicit historical request. Tests: client passthrough (default omits the param; opt-in forwards it). 43 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -56,10 +56,14 @@ def _get(path: str, **params: Any) -> dict | list:
|
||||
def latest(commodity: str | None = None, source: str | None = None,
|
||||
delivery: str | None = None, kind: str | None = None,
|
||||
zip: str | None = None, lat: float | None = None,
|
||||
lng: float | None = None, radius_miles: float | None = None) -> dict:
|
||||
lng: float | None = None, radius_miles: float | None = None,
|
||||
include_expired: bool = False) -> dict:
|
||||
# Only send include_expired when True — _get drops None, so the default
|
||||
# call keeps its existing query string (current + future months only).
|
||||
return _get("/api/data/latest",
|
||||
commodity=commodity, source=source, delivery=delivery, kind=kind,
|
||||
zip=zip, lat=lat, lng=lng, radius_miles=radius_miles)
|
||||
zip=zip, lat=lat, lng=lng, radius_miles=radius_miles,
|
||||
include_expired=True if include_expired else None)
|
||||
|
||||
|
||||
def history(commodity: str | None = None, source_id: int | None = None,
|
||||
|
||||
Reference in New Issue
Block a user