Skip to main content
Glama

search_expenses

Read-only

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

TableJSON Schema
NameRequiredDescriptionDefault
tagsNoFilter by tags
limitNoResults per page (default 20, maximum 50)
queryNoOptional 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'.
cursorNoOpaque nextCursor returned by the previous search_expenses page. Reuse the same filters; never construct or edit this value.
dateRangeNoTime period filter. Use exactly one variant — pick the shape that matches 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.
clientEmailNoClient account email. Accountants may use this only for an accepted ExpenseBot client.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesRows matched by the filters.
totalYesSum of the matched set in home currency.
hasMoreNo
messageNo
expensesYesMatching expense rows, newest first, paginated.
pageInfoNo
nextCursorNoOpaque signed continuation; reuse with identical filters.
queryAppliedNo
totalMatchedNoPresent for free-text searches.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 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"
      +]
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

The description goes well beyond the readOnlyHint/destructiveHint annotations by disclosing pagination semantics, deterministic natural-language matching, AND-combination of structured filters, disambiguation behavior, and the fact that each result includes an exact durable Receipt ID needed by update_expense. It also warns against splitting date ranges and constructing cursors, which helps agents avoid known misuse.

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

Conciseness5/5

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

The description is dense but efficient: the first sentence states the core purpose, and each subsequent clause adds necessary behavior or important operational constraints. Avoidable redundancy is minimal, and the length is justified by the complexity and the number of behaviors an agent must know to call the tool correctly.

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 tool's complexity — 11 parameters, pagination, disambiguation, mixed structured and natural-language filtering — the description covers all critical aspects: pagination flow, cursor reuse, AND semantics, deterministic recall, and the significance of expenseId/Receipt IDs. The output schema exists, so it need not describe exact return formats, and the description still goes beyond the schema to cover usage pitfalls.

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

Parameters3/5

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

The input schema already has 100% description coverage, so the baseline is satisfied by the schema. The tool description mostly summarizes or restates filter semantics already present in the schema, such as the query combining with structured filters via AND and the pagination cursor behavior. Because the description adds little new meaning beyond the schema's rich per-parameter descriptions, it earns the baseline but not more.

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 clearly states the specific operation: 'Search and filter the user's expenses' and explicitly says it returns matching expense rows from their spreadsheet. This clearly distinguishes it from add, update, report, and tax-related sibling tools. The scope is precise: it is for retrieving already-recorded expenses, not for creating or modifying them.

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?

The description gives concrete usage instructions: paginate with hasMore/nextCursor, reuse the same filters, do not split a date range into overlapping searches, and expect a disambiguation list when multiple rows plausibly match. It does not explicitly name alternatives or when-not-to-use conditions, but the context and procedural guidance are clear enough to guide an agent.

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.

TDQS

A3.6/5.0
Disambiguation3/5

Most tools are explicitly scoped, but several analytics/retrieval tools overlap in purpose, such as get_spending_summary vs get_deep_analytics vs get_monthly_books_review, and generic search vs search_expenses vs search_knowledge. The detailed descriptions help, but an agent still has to carefully choose between near-equivalent options like correct_expenses vs update_expense and the three add_income variants.

Naming Consistency5/5

Tool names consistently use lower_snake_case with a recognizable verb prefix: get_*, list_*, add_*, create_*, check_*, scan_*, search_*, and whatif_*. Minor exceptions like fetch and search are still terse retrieval verbs rather than a different naming style, so the overall pattern is predictable.

Tool Count1/5

With 59 tools, this exceeds the 50+ threshold for an extreme tool count and creates a heavy selection surface for an agent. Even though ExpenseBot covers many subdomains, many get_/list_/add_ variants could be consolidated into fewer parameterized tools. The count undermines the otherwise clear naming structure.

Completeness3/5

The surface is strong for creating, reading, and updating expenses, reports, invoices, and Gmail scans, but there are notable lifecycle gaps: no delete/void tools for expenses, income, reports, or invoices, and no update tool for income. Several descriptions explicitly redirect unsupported edits to the web app, confirming that the assistant cannot complete those workflows directly.