Skip to main content
Glama

Analyze a field across requests

analyze_field
Read-only

Aggregate 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

NameRequiredDescriptionDefault
statusNoOnly 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.
dimensionNoBreak 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.
operationNo`rank` counts requests per value and works on every field. The rest need a numeric field.rank
field_labelNoThe 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_afterNoOnly requests submitted on/after this date (YYYY-MM-DD).
field_filtersNoNarrow 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_beforeNoOnly requests submitted on/before this date (YYYY-MM-DD).
group_by_labelNoOptional 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_queryNoOptional workflow-name substring. Scoping to one workflow makes the answer exact, because a label can mean different things in different workflows.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / status
      Added value: +{
      +  "description": "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.",
      +  "items": {
      +    "enum": [
      +      "pending",
      +      "approved",
      +      "rejected",
      +      "canceled",
      +      "change_requested",
      +      "deferred",
      +      "scheduled",
      +      "draft",
      +      "under_moderation"
      +    ],
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Goes well beyond the readOnlyHint annotation by disclosing non-obvious behavior: numeric operations silently exclude draft/rejected/canceled requests, status_scope reports what was actually counted, duplicate form-field/line-item values are counted once and surfaced in warnings, and currency is stored in MINOR units. These are exactly the traps that would cause a wrong answer if undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and the aggregate-vs-list distinction are front-loaded, and nearly every sentence carries a distinct rule or caveat. It is dense to the point of being a wall of prose with several multi-clause sentences, which slightly slows scanning despite the lack of filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a nine-parameter tool with no output schema, the description compensates by describing the shape of results (status_scope, warnings, note) and the counting rules that determine them. An agent has enough to call this correctly and to report figures honestly without additional documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning the schema does not: group_by_label is only meaningful with a numeric operation, field_filters entries must all match the SAME line so multi-item queries need separate calls, and dimension is the alternative to field_label rather than a companion. It stops short of covering workflow_query's scoping rationale in the description, leaving that to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ('Aggregate any workflow field across the requests this user can see') and immediately contrasts the mechanism with the naive alternative of listing and summing requests. The distinction from siblings like list_approval_requests is implied by the aggregation framing, and the scope ('this user can see') is stated up front.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes between mechanisms: group_by_label vs dimension, field_filters over search for field+value questions, and one call per line-item filter rather than combining clauses. It also names get_workflow_details as the fallback when a label is unknown, and states the status default so an agent knows when to override it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources