Skip to main content
Glama

Perpetuus CRM

Aggregate Card Field

crm_aggregate_card_field
Read-onlyIdempotent

Group cards by the value of a custom field and count each value (a group-by/tally). Use it for questions the built-in report cannot answer because the data lives in a custom field — e.g. "main loss reason" when the board has a select field like "motivo_perda" on the lost phase. Workflow: 1) crm_get_board_structure to find the field slug (and its options); 2) call this with the slug, optionally scoping by phaseId (e.g. the lost phase), date range or tags. Returns buckets [{ value, label, count }] sorted desc and topValue. Honors a maxCards scan cap (flags truncated).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "boardId": "<boardId>",
      "fieldSlug": "<fieldSlug>"
    },
    "name": "crm_aggregate_card_field"
  }
}

Input Schema

NameRequiredDescriptionDefault
tagIdsNoOptional: only cards carrying ANY of these tag documentIds.
boardIdYesBoard documentId whose cards will be scanned.
phaseIdNoOptional: only cards CURRENTLY in this phase (e.g. the lost phase).
maxCardsNoSafety cap on how many cards to scan (default 2000). Result flags truncated=true when exceeded.
fieldSlugYesSlug of the custom field to aggregate (discover it via crm_get_board_structure). E.g. "motivo_perda".
createdAfterNoOptional: only cards created at/after this ISO datetime.
createdBeforeNoOptional: only cards created at/before this ISO datetime.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • removedInput schema / properties / tagIds / items / $ref
      Removed value: -"#/properties/phaseId"
    • addedInput schema / properties / tagIds / items / description
      Added value: +"Optional: only cards CURRENTLY in this phase (e.g. the lost phase)."
    • addedInput schema / properties / tagIds / items / maxLength
      Added value: +140
    • addedInput schema / properties / tagIds / items / minLength
      Added value: +1
    • addedInput schema / properties / tagIds / items / pattern
      Added value: +"^[A-Za-z0-9_-]+$"
    • addedInput schema / properties / tagIds / items / type
      Added value: +"string"
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and closed-world scope, so safety is covered. The description goes further, disclosing the return shape (buckets of value/label/count sorted descending, plus topValue) and the maxCards scan cap with a truncated flag — behavior not derivable from the annotations alone. It stops short of saying how cards with an empty field value are bucketed, which is a small residual gap.

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?

Front-loaded with the core action, then scenario, workflow, return shape, and limits in a logical order. Slightly dense with an embedded example that borders on illustrative padding, but no sentence is wasted.

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?

Seven parameters with two required, no output schema — so the description's explanation of the returned buckets, sort order, topValue, and truncation flag is exactly what's needed to call and interpret the tool. Nothing an agent requires to invoke it correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100%, so parameters are already well documented in structured form; the description adds only the routing hint that fieldSlug comes from crm_get_board_structure and the lost-phase example. It doesn't clarify interactions between filters (e.g. how tagIds and phaseId combine), so it sits at the baseline rather than above it.

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?

States a specific verb and resource ("Group cards by the value of a custom field and count each value") with a parenthetical gloss (group-by/tally). It also distinguishes itself from the reporting sibling by explaining that it answers questions "the built-in report cannot answer because the data lives in a custom field."

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?

Explicit when-to-use framing (custom-field questions the built-in report can't serve) plus a concrete trigger scenario and a numbered prerequisite workflow pointing at crm_get_board_structure for slug discovery. Optional narrowing dimensions (phaseId, date range, tags) are enumerated.

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.