Skip to main content
Glama
This connector has been deprecated

Replaced by io.github.no-fait/infinite-audience

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.

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": "discovery_count"
  }
}

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.
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed20 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 / 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. Changed11 schema fields changed
    • addedInput schema / properties / criteria / description
      Added value: +"Simple demographic criteria; choose this or one other population input, not both"
    • addedInput schema / properties / criteria / properties / age_max / description
      Added value: +"Maximum age in years"
    • addedInput schema / properties / criteria / properties / age_min / description
      Added value: +"Minimum age in years"
    • addedInput schema / properties / criteria / properties / genders / description
      Added value: +"Gender labels to include"
    • addedInput schema / properties / criteria / properties / income_max / description
      Added value: +"Legacy input; ignored because household income is categorical. Use field-catalog filters instead."
    • addedInput schema / properties / criteria / properties / income_min / description
      Added value: +"Legacy input; ignored because household income is categorical. Use field-catalog filters instead."
    • addedInput schema / properties / criteria / properties / interests / description
      Added value: +"Interest labels to include"
    • addedInput schema / properties / criteria / properties / states / description
      Added value: +"US state abbreviations to include"
    • addedInput schema / properties / criteria / properties / zip_codes / description
      Added value: +"Five-digit ZIP codes to include"
    • addedInput schema / properties / group_by / description
      Added value: +"Field to group counts by; mutually exclusive with automatic breakdowns"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "bytes_scanned": {
      +      "description": "Measured query bytes scanned",
      +      "type": "number"
      +    },
      +    "count": {
      +      "description": "Number of matching records",
      +      "type": "number"
      +    },
      +    "estimated_cost_usd": {
      +      "description": "Estimated query cost in US dollars",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "count",
      +    "bytes_scanned",
      +    "estimated_cost_usd"
      +  ],
      +  "type": "object"
      +}
  3. First observed

TDQS

A4/5.0
Behavior4/5

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

Beyond the annotations, it discloses a real side effect ("With segment_id, the current segment count snapshot is updated"), which usefully explains why destructiveHint=true despite the preview framing, and it names the required 'discovery' scope and the failure mode for conflicting inputs. It does not say how the snapshot update affects subsequent reads or whether it is reversible.

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 non-persistence caveat are front-loaded, followed by mode enumeration and the exclusivity rule. The middle sentence is dense but every clause carries distinct information; only the scope requirement feels tacked on at the end.

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?

With an output schema present, the description need not detail return shapes, and it still notes count plus optional group_by breakdown. For a 9-parameter, all-optional tool with zero-schema constants like exclusivity and scope, the description covers what an agent needs to invoke it correctly.

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 the baseline is 3 and the schema already documents each parameter including operator/value rules. The description adds the cross-parameter exclusivity rule that the schema cannot express, but it does not further explain individual parameters such as set_logic interaction or breakdown behavior beyond one clause.

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?

The description opens with a specific verb+resource ("Preview the count for one requested population") and immediately scopes it away from persistence ("does not create a saved audience"), which separates it from create_audience. It is less explicit about how it differs from the sibling count_segment, so the differentiation is only partial.

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?

It enumerates the valid input modes (filters, filter_groups, segment_id, audience_id, segment_ids+set_logic, excluded_segment_ids) and states they are mutually exclusive, even naming the rejection code AMBIGUOUS_INPUT. What is missing is guidance on when to choose this tool over count_segment or recount_audience.

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