splitwise_resolve_category
Resolve an expense category name to its Splitwise subcategory ID, returning ranked fuzzy matches so you can pass the correct ID to create or update an expense.
Instructions
Turn a category name into the subcategory id an expense needs, with ranked fuzzy candidates.
Reads the categories from GET /get_categories through the same 24 h in-process cache
as splitwise_get_categories (refresh: true refetches). Every subcategory is
scored with difflib.SequenceMatcher on case- and accent-folded text — the best of its
name, each piece of the name split on / and spaces ("phone" → TV/Phone/Internet), and
"Parent Subcategory" (so "transportation other" picks the right "Other").
Subcategories are listed first and are the only ones that can be resolved: exactly
one exact (1.000) match, or — with no exact match — exactly one scoring ≥ 0.85
(unique_strong; a wrong category is cheap to fix with splitwise_update_expense).
Either way no other subcategory may start with the query ("tax" next to Taxi and Taxes
is ambiguous), a fuzzy match needs a query of 4+ characters, and digits in the query
must match. The closest parent categories follow, flagged "parent — not usable for
expenses", with their subcategories so you can pick one; a parent scores the better of
its own name and its best subcategory (so "groceries" surfaces "Food and drink").
The names scored are the ones Splitwise returns for this account's locale: on a
Spanish account "groceries" finds nothing but "supermercado" resolves. Query in the
language the user sees in their Splitwise app, or browse splitwise_get_categories.
When to Use:
Before
splitwise_create_expense/splitwise_update_expense, when the user named a category ("groceries", "taxi").
When NOT to Use:
To browse the whole tree — use
splitwise_get_categories.For people or groups — use
splitwise_resolve_friend/splitwise_resolve_group.
Returns:
The resolution line, a markdown table of the top limit subcategories (rank,
Name (id N), parent, score, matched on), then up to 3 parents with their
subcategories; or, with response_format json, {query, resolution, ambiguous_count, reason, resolved, subcategories: [...], parents: [...]} where
resolution is exact | unique_strong | ambiguous | none, ambiguous_count
(always present, 0 unless ambiguous) says how many candidates are in contention, and
parents carry usable_for_expenses: false.
Examples: params = {"query": "groceries"} params = {"query": "transportation other", "response_format": "json"}
Error Handling: A 401 means the API key is missing or was regenerated. A failed fetch is never cached. Several subcategories share the name "Other" — "other" alone is reported as ambiguous; qualify it with the parent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |