Analyze a field across requests
analyze_fieldAggregate any workflow field across the requests this user can see, as a database aggregate rather than by listing requests and adding them up. Numeric fields support sum/average/max/min; any field supports rank (the most common values and their counts). group_by_label cross-tabulates two fields on the same request: field_label='Amount', operation='sum', group_by_label='Vendor' answers 'what did we spend per vendor'. dimension groups by a built-in property instead — status, workflow, requestor, or day/week/month for volume over time. Works on LINE-ITEM columns as well as ordinary fields, and pairs cells from the same line. field_filters on a line-item column keeps only the matching lines, so 'spend on laptops' is the line Total summed with field_filters [{label: 'Item', value: 'laptop'}]. Every entry has to match the same line, so for laptops and monitors make one call each. Sums, averages, max and min leave out draft, rejected and canceled requests unless status names them and count every other status, pending and scheduled included, so a total is what was requested; pass status ['approved'] for what was signed off. The result's status_scope says what was counted, so repeat it with the figure. A request carrying a value both as a form field and as a line-item column counts its lines only, and warnings says how many did. Refer to fields by the label shown on the form; use get_workflow_details if unsure of the exact wording. Read note before quoting money — currency fields are stored in MINOR units — and repeat any warnings rather than presenting a truncated breakdown as complete.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "analyze_field"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Only requests in these statuses. Omit it for the default: numeric operations leave out draft, rejected and canceled, counts include everything. Pass ['approved'] for what was actually signed off. | |
| dimension | No | Break requests down by a BUILT-IN property instead of a workflow field. `month`, `week` and `day` give volume over time — that is what 'a graph of requests over the past year' means. `status`, `workflow` and `requestor` give the mix. Pass this OR `field_label`, not both. | |
| operation | No | `rank` counts requests per value and works on every field. The rest need a numeric field. | rank |
| field_label | No | The field to analyse, named as a person would say it — 'Country', 'Amount', 'Storage size', 'Item'. Use this for anything a WORKFLOW defines. For built-in properties of a request, use `dimension`. | |
| created_after | No | Only requests submitted on/after this date (YYYY-MM-DD). | |
| field_filters | No | Narrow to requests whose FIELD VALUES match, by the field's name on the form. This is how you answer 'invoices from Acme', 'requests where Country is Germany', or 'which requests have a laptop on them' — the last one works because line-item table columns are matched too, not just fields on the form itself. Combine freely with the other filters; several entries all have to match the same request. Prefer this over `search` when the user names a field and a value, because `search` is free text over the whole request and will also match a mention in a description. Use `get_workflow_details` if unsure what a workflow calls a field. | |
| created_before | No | Only requests submitted on/before this date (YYYY-MM-DD). | |
| group_by_label | No | Optional second field to break the result down by — 'sum of Amount grouped by Country' gives spend per country. Only meaningful with a numeric operation. | |
| workflow_query | No | Optional workflow-name substring. Scoping to one workflow makes the answer exact, because a label can mean different things in different workflows. |