Search emails
search_emailsTool 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": {
"where_clause": "<where_clause>"
},
"name": "search_emails"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results (default 50, max 200). Only override if user says specific number like "show me 10 emails". For vague quantities ("couple", "few", "recent"), omit this parameter to use default. | |
| offset | No | Rows to skip for paging (default 0). When the result is truncated, re-call with offset += limit to fetch the next page. | |
| order_by | No | SQL ORDER BY clause (default: email_datetime DESC) | email_datetime DESC |
| on_behalf_of | No | A teammate's email, or an agency client's from list_agency_clients, to run this call in that account: their agents, settings, connected accounts, and credits. Omit it to act on your own account. | |
| where_clause | Yes | SQL WHERE clause (without WHERE keyword). Use ONLY these columns: provider, sender_email, sender_email_lower (WHERE only; not returned; pass lowercased values), sender_name, recipients, is_outbound (BOOLEAN — true = sent from the connected mailbox, false = received), subject, content, email_datetime, attachments, reply_outcome (inbound replies only; 'interested' / 'meeting_booked' / 'not_interested' / 'neither' — the reply's classified outcome, NULL if it was never classified; to exclude a value, write reply_outcome IS DISTINCT FROM 'not_interested', which keeps the NULL rows). For participants, use sender_email_lower = ANY(ARRAY['foo@example.com', ...]). Resolve the email address first if you only have a name. For attachments JSONB, use: attachments::text ILIKE '%filename%' or attachments != '[]'::jsonb to find emails with attachments. |