Skip to main content
Glama
This connector has been deprecated

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

Count Segment

count_segment
DestructiveIdempotent

Refresh the stored record_count of one saved segment, not its parent audience. Runs a fresh BigQuery count over the segment's own definition for any subtype (filter, matched, custom), updates segment.record_count. Returns {segment_id, record_count}. For an unsaved population preview use discovery_count; for a composed audience snapshot use recount_audience. Requires 'discovery' scope.

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": {
      "segment_id": "<segment_id>"
    },
    "name": "count_segment"
  }
}

Input Schema

NameRequiredDescriptionDefault
segment_idYesThe segment ID to recount

Output Schema

NameRequiredDescriptionDefault
guidanceNoInterpretation or recovery guidance for this result
count_unitNo
page_countNoNumber of objects on this page, not the organization total
segment_idYes
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.
record_countYesFresh segment count, or null when pending or failed
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "count_state": {
      +      "description": "Unknown means no count; available does not guarantee freshness. Recount for a current value.",
      +      "enum": [
      +        "unknown",
      +        "available"
      +      ],
      +      "type": "string"
      +    },
      +    "count_unit": {
      +      "const": "records",
      +      "type": "string"
      +    },
      +    "guidance": {
      +      "description": "Interpretation or recovery guidance for this result",
      +      "type": "string"
      +    },
      +    "next_actions": {
      +      "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"
      +    },
      +    "page_count": {
      +      "description": "Number of objects on this page, not the organization total",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "population_input": {
      +      "additionalProperties": {},
      +      "description": "Population input used for the preview; IDs refer to their current saved definitions",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "record_count": {
      +      "anyOf": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Fresh segment count, or null when pending or failed"
      +    },
      +    "segment_id": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "segment_id",
      +    "record_count"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false, idempotentHint=true and destructiveHint=true; the description adds genuinely useful context the annotations cannot convey — the auth scope requirement and the fact that a real BigQuery job is executed, implying cost/latency. However, it never explains why destructiveHint=true is set (in-place overwrite of the previously stored count, reversibility, behavior on count failure), so the most consequential flag is left unelaborated.

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

Conciseness5/5

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

Front-loaded with the action and scope, then subtype coverage, then sibling routing, then the auth requirement. Every clause carries a distinct constraint; nothing is repeated from the schema or annotations.

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?

An output schema exists, so the brief return-value note is optional rather than a gap. For a single-parameter mutation the definition covers what changes, what it costs (BigQuery job), which subtypes apply, what permissions are needed, and where to go instead — nothing an agent needs 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.

Parameters4/5

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

Schema coverage is 100% and the sole parameter is documented, so the baseline is 3. The description earns above baseline by clarifying that segment_id must refer to a saved segment rather than a parent audience and that the count runs against that segment's own definition, which adds real disambiguation beyond "The segment ID to recount."

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 ("Refresh the stored record_count of one saved segment") and immediately bounds the scope ("not its parent audience"). It goes further to name the mechanism (fresh BigQuery count over the segment's own definition) and the subtypes covered, so an agent can distinguish it from recount_audience and discovery_count without opening a schema.

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?

Gives explicit routing for the two adjacent cases: "For an unsaved population preview use discovery_count; for a composed audience snapshot use recount_audience." Both the when-to-use-this and when-to-use-something-else conditions are stated, plus the 'discovery' scope prerequisite.

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