Skip to main content
Glama

search_expenses

Read-only

Search and filter the user's expenses; returns matching 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 overlapping searches.

The optional query parameter does deterministic natural-language recall over merchant, city/location, Notes (receipt items, delivery source, payer, Business purpose), Tag and category. Results include matchedFields and a short matchReason to explain the match; when several rows plausibly match, a disambiguation list is returned and each option carries the exact expenseId. Structured filters (categories, merchants, dateRange, tags, minAmount, maxAmount) combine with the query using AND. Each result includes expenseId, the exact durable Receipt ID required by update_expense. For country-based grouping or client-assignment review use groupBy:country with explicit YYYY-MM-DD start/end; this read-only mode reviews at most 100 matching expenses, so narrow the range if too large. Use exact configured categories for travel; a foreign expense is not necessarily travel. Recorded locations can resolve to derived countries, which is not proof of travel. Unknowns stay separate even with a country filter; ask about ambiguous places, never infer from currency. Country review supports categories, merchants, tags, countries and tagAssignment, not free query or pagination. Show counts and currency-separated totals, then copy the returned selectionItems (with tag/date/location expectations) into group_expenses after the user chooses destinations.

Input Schema

NameRequiredDescriptionDefault
tagsNoFilter by tags
limitNoResults per page (default 20, maximum 50)
queryNoOptional natural-language recall over merchant, city/location, Notes (receipt items, delivery source, payer, Business purpose), Tag and category. Deterministic case-insensitive matching, no embeddings. Combined with structured filters using AND. Examples: 'Tribeca restaurant', 'client dinner note'.
cursorNoOpaque nextCursor returned by the previous search_expenses page. Reuse the same filters; never construct or edit this value.
groupByNoRead-only country review; requires explicit dateRange.start/end and at most 100 matches.
countriesNoCountry-review filter: supported country names/codes, or unknown. Never infer a country from currency or an ambiguous city.
dateRangeNoTime period filter; use exactly one variant matching the user's phrasing.
maxAmountNoMaximum expense amount
merchantsNoFilter by merchant names (e.g., ['Uber', 'Starbucks'])
minAmountNoMinimum expense amount
categoriesNoFilter by expense categories (e.g., ['Travel', 'Meals'])
hasReceiptNoWhen true, return only expenses with a receipt link. When false, return only expenses without one.
clientEmailNoAccepted client's account email (accountants only).
tagAssignmentNoCountry review: unassigned means blank/Business; no_client means no canonical client tag, including project/trip-tagged rows. Neither implies business use.

Output Schema

NameRequiredDescriptionDefault
countYesRows matched by the filters.
totalYesHome-currency sum in normal search; null in country review. Use countryGroups totalsByCurrency, never sum currencies.
hasMoreNo
messageNo
expensesYesMatching expense rows, newest first, paginated.
pageInfoNo
nextCursorNoOpaque signed continuation; reuse with identical filters.
queryAppliedNo
totalMatchedNoPresent for free-text searches.
countryGroupsNoComplete bounded country review; unknown locations remain separate.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / clientEmail / description
      Previous value: -"Client account email. Accountants may use this only for an accepted ExpenseBot client."New value: +"Accepted client's account email (accountants only)."
    • changedInput schema / properties / dateRange / description
      Previous value: -"Time period filter. Use exactly one variant — pick the shape that matches the user's phrasing."New value: +"Time period filter; use exactly one variant matching the user's phrasing."
    • changedInput schema / properties / dateRange / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "month": {
      -        "description": "Month name or 1-12 (e.g., 'March' or '3')",
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "month",
      -        "type": "string"
      -      },
      -      "year": {
      -        "description": "4-digit year (e.g., 2026)",
      -        "type": "integer"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "month",
      -      "year"
      -    ],
      -    "title": "Specific month",
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "quarter": {
      -        "maximum": 4,
      -        "minimum": 1,
      -        "type": "integer"
      -      },
      -      "type": {
      -        "const": "quarter",
      -        "type": "string"
      -      },
      -      "year": {
      -        "type": "integer"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "quarter",
      -      "year"
      -    ],
      -    "title": "Quarter of a year",
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "type": {
      -        "const": "year",
      -        "type": "string"
      -      },
      -      "year": {
      -        "type": "integer"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "year"
      -    ],
      -    "title": "Full year",
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "end": {
      -        "description": "ISO date YYYY-MM-DD (inclusive)",
      -        "format": "date",
      -        "type": "string"
      -      },
      -      "start": {
      -        "description": "ISO date YYYY-MM-DD (inclusive)",
      -        "format": "date",
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "specific",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "start",
      -      "end"
      -    ],
      -    "title": "Specific date range",
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "type": {
      -        "const": "relative",
      -        "type": "string"
      -      },
      -      "value": {
      -        "description": "Relative range phrase, e.g., 'last month', 'YTD', 'this quarter', 'last 7 days'",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "value"
      -    ],
      -    "title": "Relative natural-language range",
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "month": {
      +        "description": "Month name or 1-12 (e.g., 'March' or '3')",
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "month",
      +        "type": "string"
      +      },
      +      "year": {
      +        "description": "4-digit year (e.g., 2026)",
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "month",
      +      "year"
      +    ],
      +    "title": "Specific month",
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "quarter": {
      +        "maximum": 4,
      +        "minimum": 1,
      +        "type": "integer"
      +      },
      +      "type": {
      +        "const": "quarter",
      +        "type": "string"
      +      },
      +      "year": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "quarter",
      +      "year"
      +    ],
      +    "title": "Quarter of a year",
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "type": {
      +        "const": "year",
      +        "type": "string"
      +      },
      +      "year": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "year"
      +    ],
      +    "title": "Full year",
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "end": {
      +        "description": "ISO date YYYY-MM-DD (inclusive)",
      +        "format": "date",
      +        "type": "string"
      +      },
      +      "start": {
      +        "description": "ISO date YYYY-MM-DD (inclusive)",
      +        "format": "date",
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "specific",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "start",
      +      "end"
      +    ],
      +    "title": "Specific date range",
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "type": {
      +        "const": "relative",
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Relative phrase, e.g. 'last month', 'YTD', 'last 7 days'",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "value"
      +    ],
      +    "title": "Relative natural-language range",
      +    "type": "object"
      +  }
      +]
    • changedInput schema / properties / query / description
      Previous value: -"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'."New value: +"Optional natural-language recall over merchant, city/location, Notes (receipt items, delivery source, payer, Business purpose), Tag and category. Deterministic case-insensitive matching, no embeddings. Combined with structured filters using AND. Examples: 'Tribeca restaurant', 'client dinner note'."
  2. Changed8 schema fields changed
    • addedInput schema / properties / countries
      Added value: +{
      +  "description": "Country-review filter: supported country names/codes, or unknown. Never infer a country from currency or an ambiguous city.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / groupBy
      Added value: +{
      +  "description": "Read-only country review; requires explicit dateRange.start/end and at most 100 matches.",
      +  "enum": [
      +    "country"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / tagAssignment
      Added value: +{
      +  "description": "Country review: unassigned means blank/Business; no_client means no canonical client tag, including project/trip-tagged rows. Neither implies business use.",
      +  "enum": [
      +    "all",
      +    "unassigned",
      +    "no_client"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / countryGroups
      Added value: +{
      +  "description": "Complete bounded country review; unknown locations remain separate.",
      +  "items": {
      +    "additionalProperties": true,
      +    "properties": {
      +      "count": {
      +        "type": "integer"
      +      },
      +      "country": {
      +        "type": "string"
      +      },
      +      "countryCode": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "selectionItems": {
      +        "items": {
      +          "additionalProperties": true,
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      "totalsByCurrency": {
      +        "additionalProperties": {
      +          "type": "number"
      +        },
      +        "type": "object"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / expenses / items / properties / amount / description
      Previous value: -"Functional/home-currency amount."New value: +"Amount in currency; country review uses original receipt currency."
    • changedOutput schema / properties / expenses / items / properties / currency / description
      Previous value: -"Home currency code when available."New value: +"Currency of amount."
    • changedOutput schema / properties / total / description
      Previous value: -"Sum of the matched set in home currency."New value: +"Home-currency sum in normal search; null in country review. Use countryGroups totalsByCurrency, never sum currencies."
    • changedOutput schema / properties / total / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
  3. Changed15 schema fields changed
    • removedOutput schema / description
      Removed value: -"Standard ExpenseBot tool result envelope. `message` is the human-readable summary the AI cites; `data` is the structured payload (totals, breakdowns, ids, etc.). On failure, `success` is false and `error` carries a code/message/hint triple."
    • addedOutput schema / properties / count
      Added value: +{
      +  "description": "Rows matched by the filters.",
      +  "type": "integer"
      +}
    • removedOutput schema / properties / data
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "Structured payload. Shape varies per tool — common keys: total, breakdown, comparison, sampleMeta, ids, expenseId, reportId, signupUrl, results.",
      -  "type": "object"
      -}
    • removedOutput schema / properties / error
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "Present only when success === false.",
      -  "properties": {
      -    "code": {
      -      "type": "string"
      -    },
      -    "hint": {
      -      "type": "string"
      -    },
      -    "message": {
      -      "type": "string"
      -    }
      -  },
      -  "type": "object"
      -}
    • addedOutput schema / properties / expenses
      Added value: +{
      +  "description": "Matching expense rows, newest first, paginated.",
      +  "items": {
      +    "additionalProperties": true,
      +    "properties": {
      +      "amount": {
      +        "description": "Functional/home-currency amount.",
      +        "type": "number"
      +      },
      +      "category": {
      +        "type": "string"
      +      },
      +      "currency": {
      +        "description": "Home currency code when available.",
      +        "type": "string"
      +      },
      +      "date": {
      +        "type": "string"
      +      },
      +      "dateIso": {
      +        "description": "Canonical YYYY-MM-DD when available.",
      +        "type": "string"
      +      },
      +      "expenseId": {
      +        "description": "Durable Receipt ID (Column Q). The only identity accepted by update_expense.",
      +        "type": "string"
      +      },
      +      "location": {
      +        "type": "string"
      +      },
      +      "matchReason": {
      +        "type": "string"
      +      },
      +      "matchedFields": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "merchant": {
      +        "type": "string"
      +      },
      +      "originalAmount": {
      +        "type": "number"
      +      },
      +      "originalCurrency": {
      +        "type": "string"
      +      },
      +      "tag": {
      +        "description": "Column K group (client/project/trip).",
      +        "type": "string"
      +      },
      +      "updateEligible": {
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "expenseId",
      +      "date",
      +      "amount",
      +      "tag",
      +      "updateEligible"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / hasMore
      Added value: +{
      +  "type": "boolean"
      +}
    • removedOutput schema / properties / message / description
      Removed value: -"Human-readable result text. Always present on success; prefer rendering this verbatim before any further reasoning."
    • addedOutput schema / properties / nextCursor
      Added value: +{
      +  "description": "Opaque signed continuation; reuse with identical filters.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / pageInfo
      Added value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
    • addedOutput schema / properties / queryApplied
      Added value: +{
      +  "type": "string"
      +}
    • removedOutput schema / properties / sampleMeta
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "Set when the underlying dataset was truncated. isTruncated=true means the agent saw a sample of `sampleCount` of `totalCount` rows; aggregate totals are still accurate.",
      -  "properties": {
      -    "isTruncated": {
      -      "type": "boolean"
      -    },
      -    "sampleCount": {
      -      "type": "integer"
      -    },
      -    "totalCount": {
      -      "type": "integer"
      -    }
      -  },
      -  "type": "object"
      -}
    • removedOutput schema / properties / success
      Removed value: -{
      -  "description": "False on tool errors; check before reading `data`.",
      -  "type": "boolean"
      -}
    • addedOutput schema / properties / total
      Added value: +{
      +  "description": "Sum of the matched set in home currency.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / totalMatched
      Added value: +{
      +  "description": "Present for free-text searches.",
      +  "type": "integer"
      +}
    • addedOutput schema / required
      Added value: +[
      +  "expenses",
      +  "count",
      +  "total"
      +]
  4. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds substantial behavior beyond readOnly/openWorld/non-destructive annotations: deterministic non-embedding recall, AND combination of query and filters, matchedFields/matchReason/disambiguation output, 100-row cap for country review, unknown-country handling, and currency-separated totals. These details materially help an agent understand what happens and how to interpret results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense and front-loaded, with no filler, but it arrives as a single long paragraph that mixes search mechanics, country-review rules, and workflow instructions. It earns most of its length for a 14-parameter tool, though better structure would improve scanability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 14 optional parameters, pagination, country-review mode, travel caveats, and an existing output schema, the description covers what an agent needs to call it correctly. Return-value details are appropriately left to the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning: query is deterministic natural-language recall, structured filters combine with it using AND, travel must use exact configured categories, and country filters must not infer from currency. Some individual parameters such as hasReceipt and clientEmail are left to the schema, so it is not a full 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Search and filter the user's expenses; returns matching rows from their spreadsheet.' It clearly distinguishes this from sibling tools like get_expense_by_id or get_spending_summary by describing search/filter behavior over spreadsheet rows.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives strong operational guidance: paginate with nextCursor when hasMore is true, avoid overlapping date-range searches, use groupBy:country for country grouping or client-assignment review, and do not use free query or pagination in that mode. It also names a follow-up tool, group_expenses, but does not explicitly contrast search_expenses with sibling search or summary tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.