Docs: Tool reference
customers toolset

preview_segment

Preview who is in a segment. Counts the users matching a saved segment or draft rules, with a sample, newest first. Use it to check rules before save_segment. Pass segment or rules, not both. No side effects.

Toolset
customers
Who can call it
OwnersManagersContributorsAPI keys
REST
POST /api/v1/w/{workspace}/segments/preview
Behavior
read-onlyidempotent

Input

FieldTypeDescription
segmentstringThe segment's ID (seg_…) or name.
rulesobjectFilter DSL (Appendix A) over user and company fields: email, email_domain, company, mrr, renewal_date, renewal_risk, created_at, last_active_at, attr.<key>. Company fields match any of the user's companies. Example: {"all":[{"field":"mrr","op":"gte","value":1000},{"field":"attr.plan","op":"eq","value":"enterprise"}]}
limitintegerSample size (default 25, max 100). Default: 25.

Output

FieldTypeDescription
countrequiredinteger
usersrequiredarray of object

Calling it

// MCP: tools/call
{ "name": "preview_segment", "arguments": {} }

// Typed client
await carechannel.preview_segment({});