List messages
cooper_list_messagesUse this when you need to check an inbox for new or recent mail (sent and received), for example after sending a message and waiting for a reply, or mail to one plus address such as agent+orders@. Read-only; requires auth. Inputs: inbox_id (optional; inbox id, username, or email — omit to use the account's newest inbox), limit (optional, default 50, max 200), labels (optional; the message must have every label, for example ["unread"] or ["alias:orders"]), unread (optional boolean; true keeps only unread mail, false drops it), alias (optional plus tag, or none for mail with no tag), before (optional ISO-8601 exclusive upper bound on created_at), after (optional ISO-8601 exclusive lower bound on created_at), from (optional case-insensitive substring of From), to (optional case-insensitive substring of To or Cc), subject (optional case-insensitive substring), direction (optional inbound or outbound), thread_id (optional), ascending (optional; true returns oldest first), page_token (optional cursor), wait_seconds (optional 0 to 55; holds for unread mail and returns inbox_wait; alias still applies), since (optional ISO time or wcur1 cursor; skips unread mail at or before it). Filters run on the server before limit. Returns {object:"list", inbox_id, data:[{id, thread_id, direction, status, from, to, subject, preview, created_at, labels, alias, aliases, folder, attachments?}], next_page_token}, newest first unless ascending is true. Each message includes folder from its thread. alias is the plus tag or null. Omit folder to list inbox and archive only. When wait_seconds is set, returns unread mail immediately if any is already stored. page_token is the base64url of created_at and id. Previews only, not full bodies: call cooper_get_message to read one message. Mark one read with cooper_update_message. Fails with 400 invalid_date, invalid_direction, invalid_ascending, invalid_page_token, invalid_label, invalid_unread, invalid_alias, invalid_folder, invalid_since, or label_conflict, or 404 inbox_not_found.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "cooper_list_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Case-insensitive substring of To or Cc. % and _ match those characters. | |
| from | No | Case-insensitive substring of From. % and _ match those characters. | |
| after | No | ISO-8601 exclusive lower bound on created_at. A bad value returns invalid_date. | |
| alias | No | Plus tag, such as orders for mail to username+orders@domain. none returns mail with no tag. A bad value is invalid_alias. | |
| limit | No | Max messages to return (default 50, max 200) | |
| since | No | Optional, with wait_seconds. ISO-8601 timestamp or a wcur1 cursor. Unread mail at or before that point does not finish the wait. Omit it and already-stored unread mail still returns immediately. A bad value is invalid_since. | |
| before | No | ISO-8601 exclusive upper bound on created_at. A bad value returns invalid_date. | |
| folder | No | inbox, archive, spam, trash, or all. Omit to list inbox and archive only. Ignored when wait_seconds is set. A bad value returns invalid_folder. | |
| labels | No | Keep messages that have every one of these labels. Example: ["unread"]. | |
| unread | No | true lists only messages labeled unread. false omits them. | |
| subject | No | Case-insensitive substring of the subject. % and _ match those characters. | |
| inbox_id | No | Inbox id, username, or email. Omit to use the newest inbox. | |
| ascending | No | true lists oldest first. false, the default, lists newest first. | |
| direction | No | inbound or outbound. Anything else returns invalid_direction. | |
| thread_id | No | Only messages on this thread (thr_…). | |
| page_token | No | Cursor from next_page_token. A bad token returns invalid_page_token. | |
| wait_seconds | No | Optional. When set, hold until unread mail arrives, from 0 to 55 seconds. Returns immediately when unread mail is already stored, including mail in spam or trash. Empty checks back off from about 1 second to about 5 seconds. At most 5 waits can run at once for this key, across instances. The result is object inbox_wait with timed_out. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Message previews. Call cooper_get_message for a full body. | |
| object | No | Object type name, such as list, message, or thread. | |
| inbox_id | No | Inbox id (inb_…) this object belongs to. Null when it applies to every inbox. | |
| timed_out | No | True when the wait ended without a match. | |
| next_page_token | No | Cursor for the next page, or null when this is the last page. Pass it back as page_token. |