Tools API¶
Auto-generated API reference for all MCP tool functions. Each tool module exposes public functions decorated with @mcp.tool() that handle a specific YNAB domain.
All tools use an action-based dispatch pattern: a single entry function accepts an action parameter that routes to the appropriate operation.
Budgets¶
budgets
¶
Budget tools: list budgets, get budget detail, get user info.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
_list_budgets
async
¶
_list_budgets(app: AppContext) -> str
List all available YNAB budgets.
Parameters:
-
app(AppContext) –The application context with client and cache.
Returns:
-
str–Structured text with count header and budget details.
Source code in src/ynaa_mcp/tools/budgets.py
_get_budget
async
¶
_get_budget(app: AppContext, budget_id: str, info: str | None) -> str
Get detailed information about a YNAB budget.
Parameters:
-
app(AppContext) –The application context with client and cache.
-
budget_id(str) –Resolved budget UUID.
-
info(str | None) –Optional info message from budget resolution.
Returns:
-
str–Structured text with budget details and settings.
Source code in src/ynaa_mcp/tools/budgets.py
_get_user
async
¶
_get_user(app: AppContext) -> str
Get the authenticated YNAB user's information.
Parameters:
-
app(AppContext) –The application context with client and cache.
Returns:
-
str–Structured text with the user ID.
Source code in src/ynaa_mcp/tools/budgets.py
manage_budgets
async
¶
manage_budgets(
ctx: Context,
action: Literal["list", "get", "get_user"],
budget_id_or_name: str | None = None,
) -> str
Manage YNAB budgets: list all, get details, or get user info.
Actions
list: List all budgets. No extra params needed. get: Get budget details. Uses budget_id_or_name. get_user: Get authenticated user info. No extra params needed.
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'get_user']) –The operation to perform.
-
budget_id_or_name(str | None, default:None) –Budget UUID or name (get only). Auto-resolves if only one budget exists.
Returns:
-
str–Structured text with budget or user information.
Source code in src/ynaa_mcp/tools/budgets.py
Accounts¶
accounts
¶
Account tools: list, detail, and create YNAB accounts.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
dollars_to_milliunits
¶
Convert a dollar amount to YNAB milliunits.
Uses Decimal(str(dollars)) to avoid floating-point precision issues,
then rounds to the nearest milliunit using ROUND_HALF_UP.
Parameters:
-
dollars(float) –Dollar amount to convert.
Returns:
-
int–The equivalent amount in YNAB milliunits as an integer.
Examples:
Source code in src/ynaa_mcp/converters.py
format_dollars
¶
Format a dollar amount with $ symbol and comma separators.
Parameters:
-
amount(float) –Dollar amount (already converted from milliunits).
Returns:
-
str–Formatted string like "$1,234.56" or "-$1,234.56".
Examples:
>>> format_dollars(1234.56)
'$1,234.56'
>>> format_dollars(-50.0)
'-$50.00'
>>> format_dollars(0.0)
'$0.00'
Source code in src/ynaa_mcp/converters.py
_list_accounts
async
¶
_list_accounts(
app: AppContext, budget_id: str, info: str | None, *, include_closed: bool = False
) -> str
List all accounts in a YNAB budget.
Parameters:
-
app(AppContext) –The application context with client and cache.
-
budget_id(str) –Resolved budget UUID.
-
info(str | None) –Optional info message from budget resolution.
-
include_closed(bool, default:False) –If True, include closed accounts in the list.
Returns:
-
str–Structured text with count header and account details.
Source code in src/ynaa_mcp/tools/accounts.py
_get_account
async
¶
_get_account(
app: AppContext, budget_id: str, info: str | None, *, account_id: str
) -> str
Get detailed information about a specific YNAB account.
Parameters:
-
app(AppContext) –The application context with client and cache.
-
budget_id(str) –Resolved budget UUID.
-
info(str | None) –Optional info message from budget resolution.
-
account_id(str) –The account UUID.
Returns:
-
str–Structured text with full account details.
Source code in src/ynaa_mcp/tools/accounts.py
_create_account
async
¶
_create_account(
app: AppContext,
budget_id: str,
info: str | None,
*,
name: str,
account_type: str,
balance: float,
) -> str
Create a new account in a YNAB budget.
Parameters:
-
app(AppContext) –The application context with client and cache.
-
budget_id(str) –Resolved budget UUID.
-
info(str | None) –Optional info message from budget resolution.
-
name(str) –Display name for the new account.
-
account_type(str) –Account type string.
-
balance(float) –Opening balance in dollars.
Returns:
-
str–Confirmation text with created account details.
Source code in src/ynaa_mcp/tools/accounts.py
manage_accounts
async
¶
manage_accounts(
ctx: Context,
action: Literal["list", "get", "create"],
budget_id_or_name: str | None = None,
include_closed: bool = False,
account_id: str | None = None,
name: str | None = None,
account_type: str | None = None,
balance: float | None = None,
) -> str
Manage YNAB accounts: list, get details, or create.
Actions
list: List all accounts. Uses budget_id_or_name, include_closed. get: Get account details. Uses budget_id_or_name, account_id (required). create: Create account. Uses budget_id_or_name, name (required), account_type (required), balance (required).
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'create']) –The operation to perform.
-
budget_id_or_name(str | None, default:None) –Budget UUID or name. Auto-resolves if only one budget exists.
-
include_closed(bool, default:False) –If True, include closed accounts (list only).
-
account_id(str | None, default:None) –The account UUID (get only).
-
name(str | None, default:None) –Display name for the new account (create only).
-
account_type(str | None, default:None) –Account type (create only).
-
balance(float | None, default:None) –Opening balance in dollars (create only).
Returns:
-
str–Structured text with account information or confirmation.
Raises:
-
ToolError–If required parameters for the action are missing.
Source code in src/ynaa_mcp/tools/accounts.py
Categories¶
categories
¶
Category tools: list, detail, create/update categories and groups.
_GOAL_TYPE_LABELS
module-attribute
¶
_GOAL_TYPE_LABELS: dict[str, str] = {
"TB": "Target Balance",
"TBD": "Target Balance by Date",
"MF": "Monthly Funding",
"NEED": "Needed for Spending",
"DEBT": "Debt",
}
Human-readable labels for YNAB goal type codes.
_MAX_GROUP_NAME_LENGTH
module-attribute
¶
Maximum character length for a category group name.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
dollars_to_milliunits
¶
Convert a dollar amount to YNAB milliunits.
Uses Decimal(str(dollars)) to avoid floating-point precision issues,
then rounds to the nearest milliunit using ROUND_HALF_UP.
Parameters:
-
dollars(float) –Dollar amount to convert.
Returns:
-
int–The equivalent amount in YNAB milliunits as an integer.
Examples:
Source code in src/ynaa_mcp/converters.py
format_dollars
¶
Format a dollar amount with $ symbol and comma separators.
Parameters:
-
amount(float) –Dollar amount (already converted from milliunits).
Returns:
-
str–Formatted string like "$1,234.56" or "-$1,234.56".
Examples:
>>> format_dollars(1234.56)
'$1,234.56'
>>> format_dollars(-50.0)
'-$50.00'
>>> format_dollars(0.0)
'$0.00'
Source code in src/ynaa_mcp/converters.py
normalize_month
¶
Normalize a month parameter for the YNAB API.
Accepts "YYYY-MM", "YYYY-MM-DD", or None (current month).
Parameters:
-
month(str | None) –Month string or None for current month.
Returns:
-
str–"current"or"YYYY-MM-01"format string.
Examples:
>>> normalize_month(None)
'current'
>>> normalize_month("2026-03")
'2026-03-01'
>>> normalize_month("2026-03-01")
'2026-03-01'
Source code in src/ynaa_mcp/converters.py
_format_goal_lines
¶
Build goal-info lines for a category detail view.
Parameters:
-
cat(dict[str, Any]) –Category dict from the YNAB API response.
Returns:
-
list[str]–List of formatted goal lines, or empty list if no goal.
Source code in src/ynaa_mcp/tools/categories.py
_list_categories
async
¶
_list_categories(
app: AppContext, budget_id: str, info: str | None, *, include_hidden: bool = False
) -> str
List all categories grouped by category group.
Returns:
-
str–Structured text with count header and indented hierarchy.
Source code in src/ynaa_mcp/tools/categories.py
_get_category
async
¶
_get_category(
app: AppContext, budget_id: str, info: str | None, *, category_id: str
) -> str
Get detailed information about a specific category.
Returns:
-
str–Structured text with full category details.
Source code in src/ynaa_mcp/tools/categories.py
_create_category
async
¶
_create_category(
app: AppContext,
budget_id: str,
*,
name: str,
category_group_id: str | None = None,
note: str | None = None,
goal_target: float | None = None,
goal_target_date: str | None = None,
) -> str
Create a new category.
Returns:
-
str–Confirmation text with created category details.
Source code in src/ynaa_mcp/tools/categories.py
_update_category
async
¶
_update_category(
app: AppContext,
budget_id: str,
*,
category_id: str,
name: str | None = None,
note: str | None = None,
goal_target: float | None = None,
goal_target_date: str | None = None,
) -> str
Update an existing category.
Returns:
-
str–Confirmation text with updated category details.
Source code in src/ynaa_mcp/tools/categories.py
_create_group
async
¶
_create_group(app: AppContext, budget_id: str, *, name: str) -> str
Create a new category group.
Returns:
-
str–Confirmation text with created group details.
Raises:
-
ToolError–If name exceeds 50 characters.
Source code in src/ynaa_mcp/tools/categories.py
_update_group
async
¶
_update_group(
app: AppContext, budget_id: str, *, category_group_id: str, name: str
) -> str
Update an existing category group.
Returns:
-
str–Confirmation text with updated group details.
Raises:
-
ToolError–If name exceeds 50 characters.
Source code in src/ynaa_mcp/tools/categories.py
_set_month_budget
async
¶
_set_month_budget(
app: AppContext,
budget_id: str,
*,
category_id: str,
month: str | None = None,
budgeted: float | None = None,
) -> str
Get or update the budgeted amount for a category in a specific month.
Returns:
-
str–Structured text with category budget details or confirmation.
Source code in src/ynaa_mcp/tools/categories.py
manage_categories
async
¶
manage_categories(
ctx: Context,
action: Literal[
"list",
"get",
"create",
"update",
"create_group",
"update_group",
"set_month_budget",
],
budget_id_or_name: str | None = None,
include_hidden: bool = False,
category_id: str | None = None,
category_group_id: str | None = None,
name: str | None = None,
note: str | None = None,
goal_target: float | None = None,
goal_target_date: str | None = None,
month: str | None = None,
budgeted: float | None = None,
) -> str
Manage YNAB categories: list, get, create, update, and budget by month.
Actions
list: List all categories. Uses budget_id_or_name, include_hidden. get: Get category details. Uses category_id (required). create: Create category. Uses name (required), category_group_id, note, goal_target, goal_target_date. update: Update category. Uses category_id (required), name, note, goal_target, goal_target_date. create_group: Create category group. Uses name (required). update_group: Update category group. Uses category_group_id (required), name (required). set_month_budget: Get or set month budget. Uses category_id (required), month, budgeted (omit to get current value).
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'create', 'update', 'create_group', 'update_group', 'set_month_budget']) –The operation to perform.
-
budget_id_or_name(str | None, default:None) –Budget UUID or name. Auto-resolves if only one budget exists.
-
include_hidden(bool, default:False) –If True, include hidden categories (list only).
-
category_id(str | None, default:None) –The category UUID (get, update, set_month_budget).
-
category_group_id(str | None, default:None) –Category group UUID (create, update_group).
-
name(str | None, default:None) –Name for category or group.
-
note(str | None, default:None) –Category note (create, update).
-
goal_target(float | None, default:None) –Goal target in dollars (create, update).
-
goal_target_date(str | None, default:None) –Goal target date (create, update).
-
month(str | None, default:None) –Month as YYYY-MM or YYYY-MM-DD (set_month_budget).
-
budgeted(float | None, default:None) –Budgeted amount in dollars (set_month_budget).
Returns:
-
str–Structured text with category information or confirmation.
Raises:
-
ToolError–If required parameters for the action are missing.
Source code in src/ynaa_mcp/tools/categories.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | |
Transactions¶
transactions
¶
Transaction tools: consolidated manage_transactions dispatch.
_CLEARED_INDICATORS
module-attribute
¶
_CLEARED_INDICATORS: dict[str, str] = {
"cleared": "[C]",
"uncleared": "[U]",
"reconciled": "[R]",
}
Compact status indicators for transaction list view.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
dollars_to_milliunits
¶
Convert a dollar amount to YNAB milliunits.
Uses Decimal(str(dollars)) to avoid floating-point precision issues,
then rounds to the nearest milliunit using ROUND_HALF_UP.
Parameters:
-
dollars(float) –Dollar amount to convert.
Returns:
-
int–The equivalent amount in YNAB milliunits as an integer.
Examples:
Source code in src/ynaa_mcp/converters.py
format_dollars
¶
Format a dollar amount with $ symbol and comma separators.
Parameters:
-
amount(float) –Dollar amount (already converted from milliunits).
Returns:
-
str–Formatted string like "$1,234.56" or "-$1,234.56".
Examples:
>>> format_dollars(1234.56)
'$1,234.56'
>>> format_dollars(-50.0)
'-$50.00'
>>> format_dollars(0.0)
'$0.00'
Source code in src/ynaa_mcp/converters.py
normalize_month
¶
Normalize a month parameter for the YNAB API.
Accepts "YYYY-MM", "YYYY-MM-DD", or None (current month).
Parameters:
-
month(str | None) –Month string or None for current month.
Returns:
-
str–"current"or"YYYY-MM-01"format string.
Examples:
>>> normalize_month(None)
'current'
>>> normalize_month("2026-03")
'2026-03-01'
>>> normalize_month("2026-03-01")
'2026-03-01'
Source code in src/ynaa_mcp/converters.py
_format_transaction_line
¶
Format a single transaction for list view.
Each transaction produces two lines: a summary line with date, payee, amount, category, and cleared status, followed by the transaction ID.
Parameters:
-
txn(dict[str, Any]) –Transaction dict from the YNAB API response.
Returns:
-
list[str]–Two-element list: summary line and ID line.
Source code in src/ynaa_mcp/tools/transactions.py
_format_transaction_detail
¶
Format a single transaction for detail view.
Includes all fields with optional ones only shown when present. Subtransactions are displayed as an indented list.
Parameters:
-
txn(dict[str, Any]) –Transaction dict from the YNAB API response.
Returns:
-
list[str]–List of formatted lines for the detail view.
Source code in src/ynaa_mcp/tools/transactions.py
_format_transaction_confirmation
¶
Format a transaction create/update/delete confirmation.
Parameters:
-
verb(str) –Action word ("created", "updated", "deleted").
-
txn(dict[str, Any]) –Transaction dict from the YNAB API response.
Returns:
-
str–Confirmation string with key transaction fields.
Source code in src/ynaa_mcp/tools/transactions.py
_format_batch_result
¶
Format a batch transaction create/update response.
Parameters:
-
data(dict[str, Any]) –Response dict from the YNAB API with transaction_ids and optionally duplicate_import_ids.
-
verb(str) –Action word ("created" or "updated").
Returns:
-
str–Summary string with count header, per-ID lines, and duplicate IDs.
Source code in src/ynaa_mcp/tools/transactions.py
_list_transactions
async
¶
_list_transactions(
app: AppContext,
budget_id: str,
since_date: str | None,
until_date: str | None,
type: str | None,
account_id: str | None,
category_id: str | None,
payee_id: str | None,
month: str | None,
limit: int | None,
) -> str
List transactions with optional filtering.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
since_date(str | None) –Only return transactions on or after this date.
-
until_date(str | None) –Only return transactions on or before this date.
-
type(str | None) –Filter by transaction type.
-
account_id(str | None) –Filter by account.
-
category_id(str | None) –Filter by category.
-
payee_id(str | None) –Filter by payee.
-
month(str | None) –Filter by month.
-
limit(int | None) –Maximum number of transactions to return.
Returns:
-
str–Structured text with transaction listings.
Raises:
-
ToolError–If more than one filter param is provided.
Source code in src/ynaa_mcp/tools/transactions.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
_get_transaction
async
¶
_get_transaction(app: AppContext, budget_id: str, transaction_id: str) -> str
Get detailed information about a specific transaction.
Returns:
-
str–Structured text with full transaction detail view.
Source code in src/ynaa_mcp/tools/transactions.py
_create_transaction
async
¶
_create_transaction(
app: AppContext,
budget_id: str,
account_id: str | None,
date: str | None,
amount: float | None,
payee_name: str | None,
payee_id: str | None,
category_id: str | None,
memo: str | None,
cleared: str | None,
approved: bool | None,
flag_color: str | None,
) -> str
Create a new transaction.
Returns:
-
str–Confirmation text.
Raises:
-
ToolError–If required fields are missing.
Source code in src/ynaa_mcp/tools/transactions.py
_update_transaction
async
¶
_update_transaction(
app: AppContext,
budget_id: str,
transaction_id: str,
account_id: str | None,
date: str | None,
amount: float | None,
payee_name: str | None,
payee_id: str | None,
category_id: str | None,
memo: str | None,
cleared: str | None,
approved: bool | None,
flag_color: str | None,
) -> str
Update an existing transaction.
Returns:
-
str–Confirmation text.
Source code in src/ynaa_mcp/tools/transactions.py
_delete_transaction
async
¶
_delete_transaction(app: AppContext, budget_id: str, transaction_id: str) -> str
Delete a transaction.
Returns:
-
str–Confirmation text.
Source code in src/ynaa_mcp/tools/transactions.py
_batch_create_transactions
async
¶
_batch_create_transactions(
app: AppContext, budget_id: str, transactions: list[dict[str, Any]] | None
) -> str
Create multiple transactions in a single API call.
Returns:
-
str–Summary with count of created transactions and their IDs.
Raises:
-
ToolError–If transactions list is empty or None.
Source code in src/ynaa_mcp/tools/transactions.py
_batch_update_transactions
async
¶
_batch_update_transactions(
app: AppContext, budget_id: str, transactions: list[dict[str, Any]] | None
) -> str
Update multiple transactions in a single API call.
Returns:
-
str–Summary with count of updated transactions and their IDs.
Raises:
-
ToolError–If transactions list is empty or None.
Source code in src/ynaa_mcp/tools/transactions.py
_import_transactions
async
¶
_import_transactions(app: AppContext, budget_id: str) -> str
Trigger import of transactions from linked accounts.
Returns:
-
str–Summary of imported transactions, or message if none imported.
Source code in src/ynaa_mcp/tools/transactions.py
manage_transactions
async
¶
manage_transactions(
ctx: Context,
action: Literal[
"list",
"get",
"create",
"update",
"delete",
"batch_create",
"batch_update",
"import",
],
budget_id_or_name: str = "last-used",
transaction_id: str | None = None,
account_id: str | None = None,
date: str | None = None,
amount: float | None = None,
payee_name: str | None = None,
payee_id: str | None = None,
category_id: str | None = None,
memo: str | None = None,
cleared: str | None = None,
approved: bool | None = None,
flag_color: str | None = None,
since_date: str | None = None,
until_date: str | None = None,
type: str | None = None,
month: str | None = None,
limit: int | None = None,
transactions: list[dict[str, Any]] | None = None,
) -> str
Manage YNAB transactions: list, get, create, update, delete, batch, import.
Dispatches to the appropriate action based on the action parameter.
Actions
list: List transactions with optional filtering. Params: budget_id_or_name, since_date, until_date, type, account_id, category_id, payee_id, month, limit. Only one of account_id/category_id/payee_id/month at a time. get: Get full detail for a transaction. Params: budget_id_or_name, transaction_id (required). create: Create a new transaction. Params: budget_id_or_name, account_id (required), date (required), amount (required), payee_name, payee_id, category_id, memo, cleared, approved, flag_color. update: Update an existing transaction. Params: budget_id_or_name, transaction_id (required), plus any optional fields to change. delete: Delete a transaction. Params: budget_id_or_name, transaction_id (required). batch_create: Create multiple transactions at once. Params: budget_id_or_name, transactions (required, list[dict]). batch_update: Update multiple transactions at once. Params: budget_id_or_name, transactions (required, list[dict]). import: Import transactions from linked bank accounts. Params: budget_id_or_name only.
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'create', 'update', 'delete', 'batch_create', 'batch_update', 'import']) –The operation to perform.
-
budget_id_or_name(str, default:'last-used') –Budget UUID or name. Defaults to "last-used".
-
transaction_id(str | None, default:None) –Transaction UUID (required for get, update, delete).
-
account_id(str | None, default:None) –Account UUID (required for create, filter for list).
-
date(str | None, default:None) –Transaction date as ISO string (required for create).
-
amount(float | None, default:None) –Amount in dollars (required for create, converted to milliunits).
-
payee_name(str | None, default:None) –Payee display name.
-
payee_id(str | None, default:None) –Payee UUID (filter for list, field for create/update).
-
category_id(str | None, default:None) –Category UUID (filter for list, field for create/update).
-
memo(str | None, default:None) –Transaction memo.
-
cleared(str | None, default:None) –Cleared status ("cleared", "uncleared", "reconciled").
-
approved(bool | None, default:None) –Whether the transaction is approved.
-
flag_color(str | None, default:None) –Flag color for the transaction.
-
since_date(str | None, default:None) –Only return transactions on or after this date (list only).
-
until_date(str | None, default:None) –Only return transactions on or before this date (list only).
-
type(str | None, default:None) –Filter by type ("uncategorized" or "unapproved", list only).
-
month(str | None, default:None) –Filter by month (list only, "YYYY-MM" or "YYYY-MM-DD").
-
limit(int | None, default:None) –Maximum number of transactions to return (list only).
-
transactions(list[dict[str, Any]] | None, default:None) –List of transaction dicts (batch_create/batch_update only).
Returns:
-
str–Structured text with the requested transaction data.
Raises:
-
ToolError–If required parameters for the action are missing.
Source code in src/ynaa_mcp/tools/transactions.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | |
Payees¶
payees
¶
Payee tools: list, detail, rename, and payee location tools.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
_list_payees
async
¶
_list_payees(
app: AppContext, budget_id: str, *, include_transfers: bool = False
) -> str
List all payees in a budget.
Returns:
-
str–Structured text with count header and payee lines.
Source code in src/ynaa_mcp/tools/payees.py
_get_payee
async
¶
_get_payee(app: AppContext, budget_id: str, *, payee_id: str) -> str
Get detailed information about a specific payee.
Returns:
-
str–Structured text with payee details.
Source code in src/ynaa_mcp/tools/payees.py
_update_name
async
¶
_update_name(app: AppContext, budget_id: str, *, payee_id: str, name: str) -> str
Rename a payee.
Returns:
-
str–Confirmation text with the updated payee name and ID.
Source code in src/ynaa_mcp/tools/payees.py
_list_locations
async
¶
_list_locations(app: AppContext, budget_id: str, *, payee_id: str | None = None) -> str
List payee locations, optionally filtered by payee.
Returns:
-
str–Structured text with count header and location lines.
Source code in src/ynaa_mcp/tools/payees.py
_get_location
async
¶
_get_location(app: AppContext, budget_id: str, *, payee_location_id: str) -> str
Get detailed information about a specific payee location.
Returns:
-
str–Structured text with payee location details.
Source code in src/ynaa_mcp/tools/payees.py
manage_payees
async
¶
manage_payees(
ctx: Context,
action: Literal["list", "get", "update_name", "list_locations", "get_location"],
budget_id_or_name: str = "last-used",
include_transfers: bool = False,
payee_id: str | None = None,
name: str | None = None,
payee_location_id: str | None = None,
) -> str
Manage YNAB payees: list, get details, rename, and query locations.
Actions
list: List all payees. Uses budget_id_or_name, include_transfers. get: Get payee details. Uses payee_id (required). update_name: Rename payee. Uses payee_id (required), name (required). list_locations: List payee locations. Uses payee_id (optional filter). get_location: Get location details. Uses payee_location_id (required).
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'update_name', 'list_locations', 'get_location']) –The operation to perform.
-
budget_id_or_name(str, default:'last-used') –Budget UUID or name. Defaults to "last-used".
-
include_transfers(bool, default:False) –If True, include transfer payees (list only).
-
payee_id(str | None, default:None) –The payee UUID (get, update_name, list_locations).
-
name(str | None, default:None) –New name for the payee (update_name only).
-
payee_location_id(str | None, default:None) –The payee location UUID (get_location only).
Returns:
-
str–Structured text with payee information or confirmation.
Raises:
-
ToolError–If required parameters for the action are missing.
Source code in src/ynaa_mcp/tools/payees.py
Months¶
months
¶
Month tools: consolidated manage_months with action-parameter dispatch.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
format_dollars
¶
Format a dollar amount with $ symbol and comma separators.
Parameters:
-
amount(float) –Dollar amount (already converted from milliunits).
Returns:
-
str–Formatted string like "$1,234.56" or "-$1,234.56".
Examples:
>>> format_dollars(1234.56)
'$1,234.56'
>>> format_dollars(-50.0)
'-$50.00'
>>> format_dollars(0.0)
'$0.00'
Source code in src/ynaa_mcp/converters.py
normalize_month
¶
Normalize a month parameter for the YNAB API.
Accepts "YYYY-MM", "YYYY-MM-DD", or None (current month).
Parameters:
-
month(str | None) –Month string or None for current month.
Returns:
-
str–"current"or"YYYY-MM-01"format string.
Examples:
>>> normalize_month(None)
'current'
>>> normalize_month("2026-03")
'2026-03-01'
>>> normalize_month("2026-03-01")
'2026-03-01'
Source code in src/ynaa_mcp/converters.py
_list_months
async
¶
_list_months(app: AppContext, budget_id: str) -> str
List all budget months, excluding deleted ones.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
Returns:
-
str–Structured text with count header and month summaries,
-
str–or "No months found." if none exist.
Source code in src/ynaa_mcp/tools/months.py
_get_month
async
¶
_get_month(app: AppContext, budget_id: str, month: str) -> str
Get detailed information about a specific budget month.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
month(str) –Month as "YYYY-MM" or "YYYY-MM-DD".
Returns:
-
str–Structured text with month summary and grouped category detail.
Source code in src/ynaa_mcp/tools/months.py
_list_money_movements
async
¶
_list_money_movements(app: AppContext, budget_id: str, month: str | None) -> str
List money movements in a budget, optionally scoped to a month.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
month(str | None) –If provided, scope to this month ("YYYY-MM" or "YYYY-MM-DD").
Returns:
-
str–Structured text with count header and movement lines,
-
str–or "No money movements found." if none exist.
Source code in src/ynaa_mcp/tools/months.py
_list_money_movement_groups
async
¶
_list_money_movement_groups(app: AppContext, budget_id: str, month: str | None) -> str
List money movement groups in a budget, optionally scoped to a month.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
month(str | None) –If provided, scope to this month ("YYYY-MM" or "YYYY-MM-DD").
Returns:
-
str–Structured text with count header and group lines,
-
str–or "No money movement groups found." if none exist.
Source code in src/ynaa_mcp/tools/months.py
manage_months
async
¶
manage_months(
ctx: Context,
action: Literal[
"list", "get", "list_money_movements", "list_money_movement_groups"
],
budget_id_or_name: str = "last-used",
month: str | None = None,
) -> str
Manage YNAB budget months: list, get detail, and view money movements.
Dispatches to the appropriate action based on the action parameter.
Actions
list: List all budget months with income, budgeted, activity, to-be-budgeted, and age of money. Params: budget_id_or_name. get: Get detailed month with category breakdowns grouped by category group. Params: budget_id_or_name, month (required). list_money_movements: List money movements (category-level). Params: budget_id_or_name, month (optional -- all if omitted). list_money_movement_groups: List money movement groups (group-level). Params: budget_id_or_name, month (optional -- all if omitted).
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'list_money_movements', 'list_money_movement_groups']) –The operation to perform.
-
budget_id_or_name(str, default:'last-used') –Budget UUID or name. Defaults to "last-used".
-
month(str | None, default:None) –Month as "YYYY-MM" or "YYYY-MM-DD". Required for "get", optional for "list_money_movements" and "list_money_movement_groups".
Returns:
-
str–Structured text with the requested month data.
Raises:
-
ToolError–If "get" is called without
month.
Source code in src/ynaa_mcp/tools/months.py
Scheduled Transactions¶
scheduled
¶
Scheduled transaction tools: consolidated manage_scheduled_transactions.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
resolve_budget
async
¶
resolve_budget(
client: YNABClient,
budget_id_or_name: str | None = None,
*,
cache: CacheStore | None = None,
) -> tuple[str, str | None]
Resolve a budget identifier to a budget ID.
Fetches the list of budgets from the YNAB API and resolves the given identifier to a concrete budget ID. Supports three modes:
- No identifier: Auto-selects if exactly one budget exists, otherwise lists available budgets in the error message.
- UUID: Returns the ID directly if it matches a known budget.
- Fuzzy name: Case-insensitive fuzzy matching using
difflib.SequenceMatcherwith a threshold of 0.6.
Parameters:
-
client(YNABClient) –The YNAB API client instance.
-
budget_id_or_name(str | None, default:None) –Optional budget UUID or name to resolve.
-
cache(CacheStore | None, default:None) –Optional CacheStore for TTL-based budget list caching.
Returns:
-
str–A tuple of
(budget_id, info_message)whereinfo_message -
str | None–is None or an informational note about how the budget was resolved.
Raises:
-
ToolError–If resolution fails (no budgets, ambiguous, no match).
Source code in src/ynaa_mcp/budget_resolver.py
dollars_to_milliunits
¶
Convert a dollar amount to YNAB milliunits.
Uses Decimal(str(dollars)) to avoid floating-point precision issues,
then rounds to the nearest milliunit using ROUND_HALF_UP.
Parameters:
-
dollars(float) –Dollar amount to convert.
Returns:
-
int–The equivalent amount in YNAB milliunits as an integer.
Examples:
Source code in src/ynaa_mcp/converters.py
format_dollars
¶
Format a dollar amount with $ symbol and comma separators.
Parameters:
-
amount(float) –Dollar amount (already converted from milliunits).
Returns:
-
str–Formatted string like "$1,234.56" or "-$1,234.56".
Examples:
>>> format_dollars(1234.56)
'$1,234.56'
>>> format_dollars(-50.0)
'-$50.00'
>>> format_dollars(0.0)
'$0.00'
Source code in src/ynaa_mcp/converters.py
_format_scheduled_transaction_line
¶
Format a single scheduled transaction for list view.
Each transaction produces two lines: a summary line with next date (or first date), payee, amount, category, and frequency, followed by the transaction ID.
Parameters:
-
txn(dict[str, Any]) –Scheduled transaction dict from the YNAB API response.
Returns:
-
list[str]–Two-element list: summary line and ID line.
Source code in src/ynaa_mcp/tools/scheduled.py
_format_scheduled_transaction_detail
¶
Format a single scheduled transaction for detail view.
Includes all fields with optional ones only shown when present. Subtransactions are displayed as an indented list.
Parameters:
-
txn(dict[str, Any]) –Scheduled transaction dict from the YNAB API response.
Returns:
-
list[str]–List of formatted lines for the detail view.
Source code in src/ynaa_mcp/tools/scheduled.py
_format_scheduled_transaction_confirmation
¶
Format a scheduled transaction create/update/delete confirmation.
Parameters:
-
verb(str) –Action word ("created", "updated", "deleted").
-
txn(dict[str, Any]) –Scheduled transaction dict from the YNAB API response.
Returns:
-
str–Confirmation string with key scheduled transaction fields.
Source code in src/ynaa_mcp/tools/scheduled.py
_list_scheduled
async
¶
_list_scheduled(app: AppContext, budget_id: str) -> str
List all scheduled transactions, excluding deleted ones.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
Returns:
-
str–Structured text with count header and scheduled transaction lines,
-
str–or "No scheduled transactions found." if none exist.
Source code in src/ynaa_mcp/tools/scheduled.py
_get_scheduled
async
¶
_get_scheduled(app: AppContext, budget_id: str, scheduled_transaction_id: str) -> str
Get detailed information about a specific scheduled transaction.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
scheduled_transaction_id(str) –The scheduled transaction UUID.
Returns:
-
str–Structured text with full scheduled transaction detail view.
Source code in src/ynaa_mcp/tools/scheduled.py
_create_scheduled
async
¶
_create_scheduled(
app: AppContext,
budget_id: str,
account_id: str | None,
date: str | None,
amount: float | None,
frequency: str | None,
payee_name: str | None,
payee_id: str | None,
category_id: str | None,
memo: str | None,
flag_color: str | None,
) -> str
Create a new scheduled transaction.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
account_id(str | None) –Account UUID (required).
-
date(str | None) –Scheduled transaction date (required).
-
amount(float | None) –Amount in dollars (converted to milliunits).
-
frequency(str | None) –Recurrence frequency.
-
payee_name(str | None) –Payee display name.
-
payee_id(str | None) –Payee UUID.
-
category_id(str | None) –Category UUID.
-
memo(str | None) –Memo text.
-
flag_color(str | None) –Flag color.
Returns:
-
str–Confirmation text with key scheduled transaction fields.
Raises:
-
ToolError–If required fields (account_id, date) are missing.
Source code in src/ynaa_mcp/tools/scheduled.py
_update_scheduled
async
¶
_update_scheduled(
app: AppContext,
budget_id: str,
scheduled_transaction_id: str,
account_id: str | None,
date: str | None,
amount: float | None,
frequency: str | None,
payee_name: str | None,
payee_id: str | None,
category_id: str | None,
memo: str | None,
flag_color: str | None,
) -> str
Update an existing scheduled transaction.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
scheduled_transaction_id(str) –The scheduled transaction UUID.
-
account_id(str | None) –Account UUID.
-
date(str | None) –Scheduled transaction date.
-
amount(float | None) –Amount in dollars (converted to milliunits).
-
frequency(str | None) –Recurrence frequency.
-
payee_name(str | None) –Payee display name.
-
payee_id(str | None) –Payee UUID.
-
category_id(str | None) –Category UUID.
-
memo(str | None) –Memo text.
-
flag_color(str | None) –Flag color.
Returns:
-
str–Confirmation text with key scheduled transaction fields.
Source code in src/ynaa_mcp/tools/scheduled.py
_delete_scheduled
async
¶
_delete_scheduled(
app: AppContext, budget_id: str, scheduled_transaction_id: str
) -> str
Delete a scheduled transaction.
Parameters:
-
app(AppContext) –The application context with client.
-
budget_id(str) –Resolved budget UUID.
-
scheduled_transaction_id(str) –The scheduled transaction UUID.
Returns:
-
str–Confirmation text with deleted scheduled transaction details.
Source code in src/ynaa_mcp/tools/scheduled.py
manage_scheduled_transactions
async
¶
manage_scheduled_transactions(
ctx: Context,
action: Literal["list", "get", "create", "update", "delete"],
budget_id_or_name: str = "last-used",
scheduled_transaction_id: str | None = None,
account_id: str | None = None,
date: str | None = None,
amount: float | None = None,
frequency: str | None = None,
payee_name: str | None = None,
payee_id: str | None = None,
category_id: str | None = None,
memo: str | None = None,
flag_color: str | None = None,
) -> str
Manage YNAB scheduled transactions: list, get, create, update, delete.
Dispatches to the appropriate action based on the action parameter.
Actions
list: List all scheduled transactions (excludes deleted). Params: budget_id_or_name. get: Get full detail for a scheduled transaction. Params: budget_id_or_name, scheduled_transaction_id (required). create: Create a new scheduled transaction. Params: budget_id_or_name, account_id (required), date (required), amount, frequency, payee_name, payee_id, category_id, memo, flag_color. update: Update an existing scheduled transaction. Params: budget_id_or_name, scheduled_transaction_id (required), plus any optional fields to change. delete: Delete a scheduled transaction. Params: budget_id_or_name, scheduled_transaction_id (required).
Parameters:
-
ctx(Context) –The MCP context providing access to lifespan dependencies.
-
action(Literal['list', 'get', 'create', 'update', 'delete']) –The operation to perform.
-
budget_id_or_name(str, default:'last-used') –Budget UUID or name. Defaults to "last-used".
-
scheduled_transaction_id(str | None, default:None) –Scheduled transaction UUID (required for get, update, delete).
-
account_id(str | None, default:None) –Account UUID (required for create).
-
date(str | None, default:None) –Scheduled transaction date as ISO string (required for create).
-
amount(float | None, default:None) –Amount in dollars (converted to YNAB milliunits).
-
frequency(str | None, default:None) –Recurrence frequency (never, daily, weekly, everyOtherWeek, twiceAMonth, every4Weeks, monthly, everyOtherMonth, every3Months, every4Months, twiceAYear, yearly, everyOtherYear).
-
payee_name(str | None, default:None) –Payee display name.
-
payee_id(str | None, default:None) –Payee UUID.
-
category_id(str | None, default:None) –Category UUID.
-
memo(str | None, default:None) –Scheduled transaction memo.
-
flag_color(str | None, default:None) –Flag color for the scheduled transaction.
Returns:
-
str–Structured text with the requested scheduled transaction data.
Raises:
-
ToolError–If required parameters for the action are missing.
Source code in src/ynaa_mcp/tools/scheduled.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
Cache¶
cache
¶
Cache management tool: clear cached YNAB data.
AppContext
dataclass
¶
AppContext(client: YNABClient, cache: CacheStore)
Shared dependencies for all MCP tools.
Created during server lifespan and available to tools via
ctx.lifespan_context.
Attributes:
-
client(YNABClient) –The YNAB API client instance.
-
cache(CacheStore) –The delta cache store for YNAB API responses.
clear_cache
¶
Clear cached YNAB data to force fresh API requests.
Use this if you've made changes in the YNAB app or web interface and want to ensure the latest data is fetched.
Parameters:
-
ctx(Context) –MCP context.
-
budget_id(str | None, default:None) –Optional budget ID to clear cache for. If not provided, clears all caches.
Returns:
-
str–Confirmation message.