Skip to main content
Glama

Discovery Count

discovery_count
Destructive

Preview the count for one requested population; this does not create a saved audience. With segment_id, the current segment count snapshot is updated. Returns count and optional group_by breakdown. Use filters (AND conditions) or filter_groups (advanced compound filters), segment_id (resolve filters from a saved segment), audience_id (resolve from a saved audience), or segment_ids+set_logic (compose multiple segments, optionally with excluded_segment_ids for an ad-hoc "A minus B" preview). All inputs are mutually exclusive — providing more than one is rejected with AMBIGUOUS_INPUT. Requires 'discovery' scope.

Input Schema

NameRequiredDescriptionDefault
filtersNoRaw flat Filter objects
group_byNoField with groupable=true in get_field_catalog; mutually exclusive with automatic breakdowns
set_logicNoHow to combine segment_ids (required when segment_ids is provided)
segment_idNoSaved segment ID (any subtype) — resolve its definition from the segment doc
audience_idNoSaved audience ID — resolve its composition via segment memberships (any subtype mix)
segment_idsNoMultiple segment IDs to compose
filter_groupsNoAdvanced compound filter groups
include_breakdownsNoWhen true, also return demographic/geographic breakdowns (slower). Default false.
excluded_segment_idsNoAd-hoc "A minus B" preview — segments to subtract from the segment_ids composition, without persisting an audience

Output Schema

NameRequiredDescriptionDefault
countYesNumber of matching records
guidanceNoInterpretation or recovery guidance for this result
count_unitNo
page_countNoNumber of objects on this page, not the organization total
count_stateNoUnknown means no count; available does not guarantee freshness. Recount for a current value.
next_actionsNoSuggested next calls using returned IDs and available scopes. Not executed and not user consent.
money_displayNoCurrency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed21 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / criteria
      Removed value: -{
      -  "description": "Simple demographic criteria; choose this or one other population input, not both",
      -  "properties": {
      -    "age_max": {
      -      "description": "Maximum age in years",
      -      "type": "number"
      -    },
      -    "age_min": {
      -      "description": "Minimum age in years",
      -      "type": "number"
      -    },
      -    "genders": {
      -      "description": "Gender labels to include",
      -      "items": {
      -        "type": "string"
      -      },
      -      "type": "array"
      -    },
      -    "income_max": {
      -      "description": "Legacy input; ignored because household income is categorical. Use field-catalog filters instead.",
      -      "type": "number"
      -    },
      -    "income_min": {
      -      "description": "Legacy input; ignored because household income is categorical. Use field-catalog filters instead.",
      -      "type": "number"
      -    },
      -    "interests": {
      -      "description": "Interest labels to include",
      -      "items": {
      -        "type": "string"
      -      },
      -      "type": "array"
      -    },
      -    "states": {
      -      "description": "US state abbreviations to include",
      -      "items": {
      -        "type": "string"
      -      },
      -      "type": "array"
      -    },
      -    "zip_codes": {
      -      "description": "Five-digit ZIP codes to include",
      -      "items": {
      -        "type": "string"
      -      },
      -      "type": "array"
      -    }
      -  },
      -  "type": "object"
      -}
    • changedInput schema / properties / filter_groups / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / filter_groups / items / properties
      Added value: +{
      +  "combinator": {
      +    "description": "Join to the preceding included group; ignored for the first group. AND binds before OR. Exclusion groups always subtract.",
      +    "enum": [
      +      "AND",
      +      "OR"
      +    ],
      +    "type": "string"
      +  },
      +  "filters": {
      +    "description": "All conditions in this group must match",
      +    "items": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "field": {
      +          "description": "field_name from get_field_catalog; ZIP5 also accepts zip, zip_code or postal_code. Use published operators and enum_values",
      +          "minLength": 1,
      +          "type": "string"
      +        },
      +        "op": {
      +          "enum": [
      +            "=",
      +            "!=",
      +            "<",
      +            "<=",
      +            ">",
      +            ">=",
      +            "IN",
      +            "NOT IN",
      +            "BETWEEN",
      +            "LIKE",
      +            "ARRAY_CONTAINS",
      +            "ARRAY_CONTAINS_ANY",
      +            "IS NULL",
      +            "IS NOT NULL"
      +          ],
      +          "type": "string"
      +        },
      +        "text_comparison": {
      +          "description": "STRING =, !=, IN, NOT IN, LIKE and ARRAY<STRING> ARRAY_CONTAINS, ARRAY_CONTAINS_ANY. Default exact. case_insensitive applies Unicode case folding to stored text and the supplied value; use when capitalization is incidental.",
      +          "enum": [
      +            "exact",
      +            "case_insensitive"
      +          ],
      +          "type": "string"
      +        },
      +        "trim_whitespace": {
      +          "description": "Supported STRING or ARRAY<STRING> comparisons only. Trim leading/trailing whitespace on both sides; default false.",
      +          "type": "boolean"
      +        },
      +        "value": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "number"
      +            },
      +            {
      +              "type": "boolean"
      +            },
      +            {
      +              "items": {
      +                "anyOf": [
      +                  {
      +                    "type": "string"
      +                  },
      +                  {
      +                    "type": "number"
      +                  },
      +                  {
      +                    "type": "boolean"
      +                  }
      +                ]
      +              },
      +              "type": "array"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "Scalar for comparisons; array for IN/NOT IN; ARRAY_CONTAINS_ANY matches any listed value; [lower, upper] inclusive for BETWEEN; LIKE uses % for any sequence and _ for one character; omit for IS NULL/IS NOT NULL. Use enum_values codes, not display labels"
      +        }
      +      },
      +      "required": [
      +        "field",
      +        "op"
      +      ],
      +      "type": "object"
      +    },
      +    "minItems": 1,
      +    "type": "array"
      +  },
      +  "id": {
      +    "description": "Caller-chosen group ID, for example geography; prefix _exclude:: to subtract this group",
      +    "minLength": 1,
      +    "type": "string"
      +  }
      +}
    • removedInput schema / properties / filter_groups / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / filter_groups / items / required
      Added value: +[
      +  "id",
      +  "combinator",
      +  "filters"
      +]
    • changedInput schema / properties / filters / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / filters / items / properties
      Added value: +{
      +  "field": {
      +    "description": "field_name from get_field_catalog; ZIP5 also accepts zip, zip_code or postal_code. Use published operators and enum_values",
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "op": {
      +    "enum": [
      +      "=",
      +      "!=",
      +      "<",
      +      "<=",
      +      ">",
      +      ">=",
      +      "IN",
      +      "NOT IN",
      +      "BETWEEN",
      +      "LIKE",
      +      "ARRAY_CONTAINS",
      +      "ARRAY_CONTAINS_ANY",
      +      "IS NULL",
      +      "IS NOT NULL"
      +    ],
      +    "type": "string"
      +  },
      +  "text_comparison": {
      +    "description": "STRING =, !=, IN, NOT IN, LIKE and ARRAY<STRING> ARRAY_CONTAINS, ARRAY_CONTAINS_ANY. Default exact. case_insensitive applies Unicode case folding to stored text and the supplied value; use when capitalization is incidental.",
      +    "enum": [
      +      "exact",
      +      "case_insensitive"
      +    ],
      +    "type": "string"
      +  },
      +  "trim_whitespace": {
      +    "description": "Supported STRING or ARRAY<STRING> comparisons only. Trim leading/trailing whitespace on both sides; default false.",
      +    "type": "boolean"
      +  },
      +  "value": {
      +    "anyOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "type": "number"
      +      },
      +      {
      +        "type": "boolean"
      +      },
      +      {
      +        "items": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "number"
      +            },
      +            {
      +              "type": "boolean"
      +            }
      +          ]
      +        },
      +        "type": "array"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Scalar for comparisons; array for IN/NOT IN; ARRAY_CONTAINS_ANY matches any listed value; [lower, upper] inclusive for BETWEEN; LIKE uses % for any sequence and _ for one character; omit for IS NULL/IS NOT NULL. Use enum_values codes, not display labels"
      +  }
      +}
    • removedInput schema / properties / filters / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / filters / items / required
      Added value: +[
      +  "field",
      +  "op"
      +]
    • changedInput schema / properties / group_by / description
      Previous value: -"Field to group counts by; mutually exclusive with automatic breakdowns"New value: +"Field with groupable=true in get_field_catalog; mutually exclusive with automatic breakdowns"
    • removedOutput schema / properties / bytes_scanned
      Removed value: -{
      -  "description": "Measured query bytes scanned",
      -  "type": "number"
      -}
    • addedOutput schema / properties / count_state
      Added value: +{
      +  "description": "Unknown means no count; available does not guarantee freshness. Recount for a current value.",
      +  "enum": [
      +    "unknown",
      +    "available"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / count_unit
      Added value: +{
      +  "const": "records",
      +  "type": "string"
      +}
    • removedOutput schema / properties / estimated_cost_usd
      Removed value: -{
      -  "description": "Estimated query cost in US dollars",
      -  "type": "number"
      -}
    • addedOutput schema / properties / guidance
      Added value: +{
      +  "description": "Interpretation or recovery guidance for this result",
      +  "type": "string"
      +}
    • addedOutput schema / properties / money_display
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "Currency amounts formatted once from source paths ending in _cents. Use verbatim; do not divide again. Null/missing source amounts are omitted, not zero.",
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / next_actions
      Added value: +{
      +  "description": "Suggested next calls using returned IDs and available scopes. Not executed and not user consent.",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "arguments": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "reason": {
      +        "type": "string"
      +      },
      +      "tool": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "tool",
      +      "arguments",
      +      "reason"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / page_count
      Added value: +{
      +  "description": "Number of objects on this page, not the organization total",
      +  "maximum": 9007199254740991,
      +  "minimum": -9007199254740991,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / population_input
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Population input used for the preview; IDs refer to their current saved definitions",
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "count",
      -  "bytes_scanned",
      -  "estimated_cost_usd"
      -]New value: +[
      +  "count"
      +]
  2. First observed

TDQS

A3.9/5.0
Behavior3/5

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

Annotations mark this readOnlyHint=false and destructiveHint=true, and the description explains why: with segment_id the current segment count snapshot is overwritten. That is genuinely additive context beyond the annotations. But it stops there — it never states that the snapshot overwrite is irreversible or affects what other users see, which matters for a tool flagged destructive, and it gives no cost/slowness signal beyond 'slower' on include_breakdowns.

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 and the non-persistence caveat, then a single dense sentence enumerating input modes. Every clause earns its place, though the middle sentence is long enough that a reader may skim the exclusivity constraint.

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 9-parameter, zero-required tool with an output schema, the description covers what an agent needs: what is returned (count plus optional group_by breakdown), the input-mode exclusivity rule with its error code, the snapshot side effect, and the required 'discovery' scope. Return-value details are correctly left to the output schema.

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 would be 3; the description earns above baseline by stating the mutual-exclusivity rule between filters, filter_groups, segment_id, audience_id and segment_ids+set_logic, which the schema does not encode. It also names the A-minus-B role of excluded_segment_ids. It adds little on group_by or set_logic beyond what the schema already documents.

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

Purpose4/5

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

Opens with a specific verb+resource ('Preview the count for one requested population') and immediately scopes it as non-persistent ('does not create a saved audience'), which separates it from create_audience/create_segment siblings. It does not explicitly distinguish itself from count_segment or recount_audience, so an agent still has to infer that division.

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

Usage Guidelines4/5

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

Clearly enumerates the five input modes and tells the agent they are mutually exclusive, including the exact failure (AMBIGUOUS_INPUT). Missing is guidance on when to use this instead of the closely named siblings count_segment or recount_audience, so the routing advice is internal to the tool rather than across tools.

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