Skip to main content
Glama

analyze_peg_stability

Assess the stability of USD-pegged stablecoins by generating a detailed Markdown report with historical data, current price, and analysis over a specified time period.

Instructions

Generate a peg stability analysis report for a USD-pegged stablecoin. Args: coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai'). days (int, optional): Number of days for analysis. Defaults to 7. Returns: str: A Markdown-formatted report with historical data, current price, and stability analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYes
daysNo

Implementation Reference

  • main.py:163-199 (handler)
    The handler function for the 'analyze_peg_stability' tool. It is decorated with @mcp.tool(), which also serves as the registration. The function fetches historical price data, computes deviations from $1 peg, determines stability status, and returns a formatted Markdown report.
    @mcp.tool() def analyze_peg_stability(coin: str, days: int = 7) -> str: """ Generate a peg stability analysis report for a USD-pegged stablecoin. Args: coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai'). days (int, optional): Number of days for analysis. Defaults to 7. Returns: str: A Markdown-formatted report with historical data, current price, and stability analysis. """ if coin.lower() not in STABLECOINS: return f"Error: Unsupported stablecoin. Choose from {list(STABLECOINS.keys())}" historical_data = get_historical_data(coin, days) current_price = get_current_price(coin) try: df = pd.read_json(json.dumps(cg.get_coin_market_chart_by_id( id=STABLECOINS[coin.lower()]["id"], vs_currency="usd", days=days)["prices"])) df.columns = ["Timestamp", "Price"] df["Deviation"] = (df["Price"] - 1.0) * 100 max_deviation = df["Deviation"].abs().max() stability_note = "Stable" if max_deviation < 1.0 else "Unstable" if max_deviation > 3.0 else "Moderately Stable" return ( f"**Peg Stability Analysis for {coin.upper()} (Last {days} Days)**:\n\n" f"{historical_data}\n\n" f"{current_price}\n\n" f"**Analysis**:\n" f"- Maximum Deviation: {max_deviation:.2f}%\n" f"- Stability Status: {stability_note}\n" f"- Note: Deviations > 3% indicate potential depegging risks." ) except Exception as e: return f"Error in analysis for {coin}: {str(e)}"

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kukapay/crypto-pegmon-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server