Skip to main content
Glama

Discovery Overlap

discovery_overlap

Calculate the overlap between two audience criteria sets. Returns overlap_count, overlap_pct (percentage of the smaller population), and demographic_deltas. Each side (a and b) independently accepts EXACTLY ONE of: audience_id, segment_id, segment_ids+set_logic, filter_groups, or filters (more than one per side is rejected with AMBIGUOUS_INPUT). Saved composition, exclusions, and record limits are preserved. Empty optional distributions mean unavailable, not zero. Legacy: pass audience_id_a and audience_id_b at the top level for backward compatibility (mutually exclusive with a/b). Requires 'discovery' scope.

Input Schema

NameRequiredDescriptionDefault
aNoSide A input — any of the five discovery input shapes
bNoSide B input — any of the five discovery input shapes
audience_id_aNo(Legacy) First audience ID
audience_id_bNo(Legacy) Second audience ID

Output Schema

NameRequiredDescriptionDefault
a_nameYes
b_nameYes
a_countYes
b_countYes
guidanceNoInterpretation or recovery guidance for this result
warningsNo
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.
overlap_pctYes
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.
overlap_countYes
population_inputNoPopulation input used for the preview; IDs refer to their current saved definitions
demographic_deltasYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed17 schema fields changed
    • changedInput schema / properties / a / properties / filter_groups / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / a / 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 / a / properties / filter_groups / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / a / properties / filter_groups / items / required
      Added value: +[
      +  "id",
      +  "combinator",
      +  "filters"
      +]
    • changedInput schema / properties / a / properties / filters / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / a / 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 / a / properties / filters / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / a / properties / filters / items / required
      Added value: +[
      +  "field",
      +  "op"
      +]
    • changedInput schema / properties / b / properties / filter_groups / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / b / 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 / b / properties / filter_groups / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / b / properties / filter_groups / items / required
      Added value: +[
      +  "id",
      +  "combinator",
      +  "filters"
      +]
    • changedInput schema / properties / b / properties / filters / items / additionalProperties
      Previous value: -{}New value: +false
    • addedInput schema / properties / b / 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 / b / properties / filters / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedInput schema / properties / b / properties / filters / items / required
      Added value: +[
      +  "field",
      +  "op"
      +]
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "a_count": {
      +      "type": "number"
      +    },
      +    "a_name": {
      +      "type": "string"
      +    },
      +    "b_count": {
      +      "type": "number"
      +    },
      +    "b_name": {
      +      "type": "string"
      +    },
      +    "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"
      +    },
      +    "demographic_deltas": {
      +      "items": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "guidance": {
      +      "description": "Interpretation or recovery guidance for this result",
      +      "type": "string"
      +    },
      +    "money_display": {
      +      "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"
      +    },
      +    "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"
      +    },
      +    "overlap_count": {
      +      "type": "number"
      +    },
      +    "overlap_pct": {
      +      "type": "number"
      +    },
      +    "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"
      +    },
      +    "warnings": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "a_name",
      +    "b_name",
      +    "a_count",
      +    "b_count",
      +    "overlap_count",
      +    "overlap_pct",
      +    "demographic_deltas"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false): it discloses the 'discovery' scope requirement, states that saved composition/exclusions/record limits are preserved, warns that empty optional distributions mean unavailable not zero, and documents the AMBIGUOUS_INPUT rejection. Minor gap: it doesn't clarify why readOnlyHint is false for what reads as a compute call.

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-loads purpose and return fields, then input constraints, then scope. Dense but every sentence carries real rules; the one slightly wasteful bit is listing the return fields despite an output schema existing.

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

Completeness4/5

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

For a deeply nested tool with an output schema and annotations, the description covers the key gotchas an agent needs: one-input-per-side, ambiguity rejection, preserved composition, empty-distribution semantics, legacy parameters, and auth scope. Nothing materially missing for correct invocation.

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?

On top of 100% schema coverage, it adds the crucial 'EXACTLY ONE of' constraint per side that the schema cannot express with its current shape, and explains the audience_id_a/audience_id_b legacy alternates and their mutual exclusivity with a/b. Clear value beyond the schema.

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?

States a specific verb ('Calculate') and resource ('overlap between two audience criteria sets'), which is inherently distinguishable from siblings like discovery_count, discovery_crosstab, and discovery_lookup. However, it never names or contrasts those siblings, so the agent must infer which discovery tool to pick.

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

Usage Guidelines3/5

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

The description notes the required 'discovery' scope and the mutual-exclusivity rule for the legacy parameters, which implies when to use the modern a/b shape. But it never says when to choose this tool over discovery_crosstab or discovery_count, so usage is only implied.

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