ynab_get_budgets
List all budgets available to the authenticated YNAB user, allowing AI assistants to access and manage budget data from a personal finance application.
Instructions
List all budgets available to the authenticated user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/ynab_mcp_server/server.py:88-96 (registration)MCP tool registration for 'ynab_get_budgets' - decorator registering the tool with FastMCP, including annotations for readOnly/destructive/idempotent hints.
@mcp.tool( name="ynab_get_budgets", annotations={ "title": "List YNAB Budgets", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, } - src/ynab_mcp_server/server.py:98-112 (handler)Handler function that executes the 'ynab_get_budgets' tool logic: creates a YNABClient, calls get_budgets(), formats results as markdown, and returns the formatted string.
async def ynab_get_budgets(params: GetBudgetsInput) -> str: """List all budgets available to the authenticated user.""" try: async with YNABClient() as client: budgets = await client.get_budgets() result = "## Your YNAB Budgets\n\n" for b in budgets: result += f"- **{b['name']}**\n" result += f" - ID: `{b['id']}`\n" result += f" - Last modified: {b.get('last_modified_on', 'N/A')}\n\n" return result except Exception as e: return format_error(e) - src/ynab_mcp_server/models.py:31-34 (schema)Input schema for the tool - an empty Pydantic model (no parameters needed) with whitespace stripping config.
class GetBudgetsInput(BaseModel): """Input for listing all budgets.""" model_config = ConfigDict(str_strip_whitespace=True) - src/ynab_mcp_server/api.py:198-201 (helper)API client helper that makes the actual HTTP GET request to YNAB API /budgets endpoint and returns the list of budgets.
async def get_budgets(self) -> List[Dict[str, Any]]: """Get all budgets for the authenticated user.""" response = await self._request("GET", "/budgets") return response["data"]["budgets"]