From 4a357b335f74ae64714800527ac3e95b7057a3ce Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 26 Sep 2026 08:34:55 +0200 Subject: Fix mail counts and finance ranges found testing live - mail printed threads and the model called them emails; it now reports messages and threads. - finance spending takes a since date (default the first of the month) instead of a day count, and an optional asset account. The per-account listing needs an end date or the API rejects it; an unknown account name gets the user's accounts back. - Tool errors are capped at 2000 characters like normal output. Co-Authored-By: Claude Opus 5.5 --- examples/tools/mail.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'examples/tools/mail.sh') diff --git a/examples/tools/mail.sh b/examples/tools/mail.sh index 4e0e9c1..bd7219d 100755 --- a/examples/tools/mail.sh +++ b/examples/tools/mail.sh @@ -23,8 +23,11 @@ set -uo pipefail query="${1:-tag:unread and tag:inbox}" -json=$("${MAILCTL:-mailctl.py}" search "$query" --json) || { echo "mail search failed" >&2; exit 1; } -jq -r 'length as $n - | if $n == 0 then "no threads match" - else "\($n) threads", (.[:10][] | "\(.date_relative), \(.authors): \(.subject)") +mailctl="${MAILCTL:-mailctl.py}" +json=$("$mailctl" search "$query" --json) || { echo "mail search failed" >&2; exit 1; } +# Messages and threads both: the model otherwise calls threads "emails". +msgs=$("$mailctl" count "$query" | awk '{print $1}') || { echo "mail count failed" >&2; exit 1; } +jq -r --arg msgs "$msgs" 'length as $n + | if $n == 0 then "no messages match" + else "\($msgs) messages in \($n) threads", (.[:10][] | "\(.date_relative), \(.authors): \(.subject)") end' <<<"$json" -- cgit v1.2.3