fix: disable goals queries in get_budgets to work around Monarch API errors
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
All checks were successful
Build and Push Monarch MCP Docker Image / build (push) Successful in 16s
The Monarch Money API returns errors for goals-related GraphQL fields (lines 119-131 in query). Setting use_legacy_goals=False and use_v2_goals=False skips these problematic fields while still returning budget data.
This commit is contained in:
@@ -112,7 +112,9 @@ async def get_budgets(reason: Optional[str] = None) -> str:
|
|||||||
client = await get_authenticated_client()
|
client = await get_authenticated_client()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
budgets = await client.get_budgets()
|
# Disable both legacy and v2 goals to avoid API errors with goals fields
|
||||||
|
# The Monarch API appears to have issues with goals-related GraphQL fields
|
||||||
|
budgets = await client.get_budgets(use_legacy_goals=False, use_v2_goals=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = str(e)
|
error_msg = str(e)
|
||||||
# Check if this is a Monarch API error about budgets not being set up
|
# Check if this is a Monarch API error about budgets not being set up
|
||||||
@@ -120,7 +122,7 @@ async def get_budgets(reason: Optional[str] = None) -> str:
|
|||||||
return serialize_json(
|
return serialize_json(
|
||||||
{
|
{
|
||||||
"error": "Budget data unavailable",
|
"error": "Budget data unavailable",
|
||||||
"detail": "The Monarch Money API returned an error. This may occur if budgets are not configured in your account.",
|
"detail": "The Monarch Money API returned an error. This may be a temporary API issue.",
|
||||||
"raw_error": error_msg,
|
"raw_error": error_msg,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user