Handle custom ticket statuses: list_ticket_statuses tool + unresolved shortcut

The pesco instance defines 13 ticket statuses, not the 4 defaults, so a
(status:2 OR status:3) 'open tickets' filter silently dropped Working,
Scheduled, Waiting*, Pending Approval, etc. — undercounting 24 open tickets as 1.

Add a status helper that reads the status field from /ticket_form_fields and
treats only ids 4/5 (and closed/resolved-labelled) as terminal. Expose
list_ticket_statuses() and a list_tickets(unresolved=True) shortcut that builds
the full non-terminal status clause automatically. Document the gotcha in the
skill reference.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 21:36:25 -06:00
parent 61c0b39e06
commit 0b6747812f
2 changed files with 75 additions and 17 deletions

View File

@@ -5,8 +5,18 @@ API key as username (handled by `scripts/fs.py`). Full docs: https://api.freshse
## Codes
**Ticket status:** 2 Open · 3 Pending · 4 Resolved · 5 Closed
**Ticket status (defaults):** 2 Open · 3 Pending · 4 Resolved · 5 Closed
**Ticket priority:** 1 Low · 2 Medium · 3 High · 4 Urgent
> ⚠️ Instances often define **custom statuses** beyond the 4 defaults (e.g.
> "Working", "Scheduled", "Waiting Vendor Support"). Resolved and Closed are
> always ids **4** and **5**; every other status is "open". To list them all,
> read the `status` field choices:
> `GET /ticket_form_fields` → field where `name == "status"` → `choices[]`.
> So "all my tickets that aren't resolved/closed" must enumerate *every*
> non-4/5 status, not just `(status:2 OR status:3)`. Recipe:
> `agent_id:<id> AND (status:2 OR status:3 OR status:6 OR status:7 OR ...)`
> using all open ids from the status field.
**Ticket source:** 1 Email · 2 Portal · 3 Phone · 4 Chat · 5 Feedback widget ·
6 Yammer · 7 AWS CloudWatch · 8 PagerDuty · 9 Walkup · 10 Slack