set_preferred_budget_id
Set your preferred YNAB budget ID on the MCP YNAB Server to streamline access and manage financial data efficiently.
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-682 (handler)The MCP tool handler function, decorated with @mcp.tool(), that sets the preferred budget ID using the YNABResources instance and returns a confirmation string.@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-252 (helper)Supporting method in YNABResources class that stores the preferred budget ID in memory and persists it to a JSON 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)