get_cetes_28_data
Retrieve current and historical 28-day CETES interest rate data from Mexico's central bank for financial analysis and decision-making.
Instructions
Get CETES 28-day interest rate data from Banxico.
Args: limit: Maximum number of recent data points (default: 30)
Returns: Current and historical CETES 28-day rates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- banxico_mcp_server.py:512-538 (handler)The main handler function for the 'get_cetes_28_data' tool. It is registered via the @mcp.tool() decorator. Fetches CETES 28-day interest rate data from the Banxico API (series SF282), handles optional limit parameter, and formats the response using format_interest_rate_data.@mcp.tool() async def get_cetes_28_data(limit: Optional[int] = 30) -> str: """ Get CETES 28-day interest rate data from Banxico. Args: limit: Maximum number of recent data points (default: 30) Returns: Current and historical CETES 28-day rates """ if not BANXICO_TOKEN: return "Error: BANXICO_API_TOKEN environment variable not set. Please configure your API token." endpoint = "series/SF282/datos" data = await make_banxico_request(endpoint, BANXICO_TOKEN) if not data: return "Failed to retrieve CETES 28-day data. Please check your API token and network connection." # Apply limit if specified if limit and data.get("bmx", {}).get("series"): for series in data["bmx"]["series"]: if "datos" in series and len(series["datos"]) > limit: series["datos"] = series["datos"][-limit:] return format_interest_rate_data(data)