set_preferred_budget_id
Specify which YNAB budget to use for subsequent operations in the MCP YNAB Server by setting a budget ID.
Instructions
Set the preferred YNAB budget ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| budget_id | Yes |
Implementation Reference
- src/mcp_ynab/server.py:678-683 (handler)MCP tool handler for 'set_preferred_budget_id'. Decorated with @mcp.tool() which registers the tool. Delegates to YNABResources helper and returns confirmation.@mcp.tool() async def set_preferred_budget_id(budget_id: str) -> str: """Set the preferred YNAB budget ID.""" ynab_resources.set_preferred_budget_id(budget_id) return f"Preferred budget ID set to {budget_id}"
- src/mcp_ynab/server.py:248-253 (helper)Helper method in YNABResources class that sets the preferred budget ID in memory and persists it to a JSON file (actually plain text file). Called by the tool handler.def set_preferred_budget_id(self, budget_id: str) -> None: """Set the preferred budget ID.""" self._preferred_budget_id = budget_id with open(PREFERRED_BUDGET_ID_FILE, "w") as f: f.write(budget_id)
- src/mcp_ynab/server.py:678-678 (registration)The @mcp.tool() decorator registers the function as an MCP tool with the name matching the function name 'set_preferred_budget_id'.@mcp.tool()