Skip to main content
Glama

workspaces_leads_facets

Returns distinct values and their counts for a given field across workspace leads. Use this to understand data distribution before building filter conditions — especially to check whether a field uses NULL vs a zero/empty value.

Supports context fields and Lead model fields (status, contact_type). Discovery fields are not supported yet.

Results are ordered by count descending, capped at limit. Each entry is {value, count}, plus label for fields with display choices (status, contact_type) — filter on value, show label.

This powers the value checklist in the lead list's column menus, so it accepts the same qf parameter as workspaces_leads_list: pass the other columns' active quick filters and the counts returned here will match what is on screen. Any qf entry for field itself is ignored, so unticking a value does not make the other values disappear.

Method: GET /api/v1/workspaces/{workspace_sqid}/leads/facets/

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": {
      "field": "<field>"
    },
    "name": "workspaces_leads_facets"
  }
}

Input Schema

NameRequiredDescriptionDefault
qNoOnly return values containing this substring — for the search box above a value checklist.
qfNoAd-hoc column filters (same JSON format as `workspaces_leads_list`). Entries for `field` itself are ignored.
fieldYesField key to facet on (e.g. `churn_reason`, `status`).
limitNoMax distinct values to return (default 50, max 200).
filterNoFilterConfig sqid — apply this filter before computing the facet.
segmentNoSegment sqid — scope the facet to leads in this segment.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full behavioral burden and does so well: result ordering (count descending), the limit cap, the exact entry shape `{value, count, label}`, label-vs-value semantics, and the non-obvious rule that qf entries for `field` itself are ignored so unticking doesn't collapse the list. It also honestly scopes support ('Discovery fields are not supported yet').

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 the core purpose in the first sentence and structures the rest as distinct concerns (scope, output shape, qf semantics). The trailing 'Method: GET /api/v1/...' line is low value for an MCP caller and the qf paragraph is dense, but nothing is genuinely wasteful.

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 six-parameter read tool with no output schema and no annotations, the description supplies everything an agent needs: what it returns, how results are ordered and capped, the record shape, field-scope limits, and how qf interacts with the target field.

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 coverage is 100%, so all six parameters are already documented, and the description largely restates them (qf format, field-key examples, the ignored-self-filter rule). It adds only marginal meaning, such as framing `q` as the search box above a value checklist. Baseline 3 applies when the schema does the heavy lifting.

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 ('Returns distinct values and their counts for a given field across workspace leads') and immediately contrasts with the list-style siblings by emphasizing distribution rather than records. An agent can distinguish this from workspaces_leads_list without opening either schema.

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?

Gives concrete when-to-use guidance ('understand data distribution before building filter conditions') with a specific motivating case (NULL vs zero/empty). It also explains the intended workflow via workspaces_leads_list's qf parameter. It stops short of explicit when-not conditions or naming a direct alternative for fetching the underlying records.

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.