set_preferred_budget_id
Define your primary YNAB budget ID to streamline account balance checks, transaction data access, and new transaction creation within the MCP YNAB Server.
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)The MCP tool handler function for 'set_preferred_budget_id', decorated with @mcp.tool(), which delegates to the YNABResources helper method and returns a confirmation message.@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 the YNABResources class that sets the preferred budget ID in memory and persists it to a configuration file (PREFERRED_BUDGET_ID_FILE).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)