Query Monitored Companies
query_monitored_companiesmode="search" (default): individual company rows. mode="stats": aggregate counts, with optional group_by for analytics.
Columns: display_name, domain, stage ('active'/'removed'), data (JSONB),
agent_id, created_at, updated_at. JSONB queries:
data->>'last_sweep_status' = 'error'. For outreach prospects, call
query_prospects.
In search mode, {count, truncated, items array}.
In stats mode, {total, by_stage: {active: N, removed: M},
groups?: {: {total, by_stage}}}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "search" to list rows, "stats" for aggregate counts. | search |
| limit | No | Max results (default 50, capped at 100). Search mode only. | |
| offset | No | Rows to skip for paging (default 0, search mode only). When the result is truncated, re-call with offset += limit for the next page. | |
| agent_id | No | Filter to a specific agent. Omit for cross-agent queries. | |
| group_by | No | (stats mode only) JSONB data key to group by; each group carries the same by_stage map as the top-level stats. | |
| order_by | No | SQL ORDER BY (default: created_at DESC). Search mode only. | created_at DESC |
| where_clause | No | SQL WHERE condition (default: all). Examples: "stage = 'active'", "domain ILIKE '%.io'" | 1=1 |