search_expenses
Search and filter the user's expenses. Returns matching expense rows from their spreadsheet. Filter by category, merchant, date range, amount, or tags. Results are paginated: when hasMore is true, call again with nextCursor and the same filters. Do not split a date range into repeated overlapping searches.
Use the optional query parameter for deterministic natural-language recall over merchant, city/location, Notes (including receipt items, delivery source, payer, and Business purpose), Tag, and category. Each matching result includes matchedFields and a short matchReason so you can explain why it was selected. When several rows plausibly match, a disambiguation list is returned; each option carries the exact expenseId. Structured filters (categories, merchants, dateRange, tags, minAmount, maxAmount) combine with the query using AND semantics. Each result includes expenseId, the exact durable Receipt ID required by update_expense.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Filter by tags | |
| limit | No | Results per page (default 20, maximum 50) | |
| query | No | Optional natural-language recall over the user's existing expense fields (merchant, city/location, Notes including receipt items, delivery source, payer, and Business purpose, Tag, category). Deterministic case-insensitive matching — no embeddings or model classifiers. Combine with structured filters using AND semantics. Examples: 'Tribeca restaurant', 'Bodewell project hardware store', 'client dinner note'. | |
| cursor | No | Opaque nextCursor returned by the previous search_expenses page. Reuse the same filters; never construct or edit this value. | |
| dateRange | No | Time period filter. Use exactly one variant — pick the shape that matches the user's phrasing. | |
| maxAmount | No | Maximum expense amount | |
| merchants | No | Filter by merchant names (e.g., ['Uber', 'Starbucks']) | |
| minAmount | No | Minimum expense amount | |
| categories | No | Filter by expense categories (e.g., ['Travel', 'Meals']) | |
| hasReceipt | No | When true, return only expenses with a receipt link. When false, return only expenses without one. | |
| clientEmail | No | Client account email. Accountants may use this only for an accepted ExpenseBot client. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | Rows matched by the filters. | |
| total | Yes | Sum of the matched set in home currency. | |
| hasMore | No | ||
| message | No | ||
| expenses | Yes | Matching expense rows, newest first, paginated. | |
| pageInfo | No | ||
| nextCursor | No | Opaque signed continuation; reuse with identical filters. | |
| queryApplied | No | ||
| totalMatched | No | Present for free-text searches. |