Skip to main content
Glama
kukapay

crypto-pegmon-mcp

get_historical_data

Fetch historical price data for USD-pegged stablecoins, displaying date, price, and deviation in a Markdown table. Specify the stablecoin symbol and optional days for analysis.

Instructions

Fetch historical price data for a USD-pegged stablecoin and return as a Markdown table.

Args:
    coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai').
    days (int, optional): Number of days for historical data. Defaults to 7.

Returns:
    str: A Markdown table with date, price, and deviation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYes
daysNo

Implementation Reference

  • main.py:130-160 (handler)
    The handler function for the 'get_historical_data' tool. It fetches historical price data from CoinGecko API, computes deviations from $1 peg, and returns a Markdown table. Registered via @mcp.tool() decorator.
    @mcp.tool()
    def get_historical_data(coin: str, days: int = 7) -> str:
        """
        Fetch historical price data for a USD-pegged stablecoin and return as a Markdown table.
    
        Args:
            coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai').
            days (int, optional): Number of days for historical data. Defaults to 7.
    
        Returns:
            str: A Markdown table with date, price, and deviation.
        """
        if coin.lower() not in STABLECOINS:
            return f"Error: Unsupported stablecoin. Choose from {list(STABLECOINS.keys())}"
        
        coin_id = STABLECOINS[coin.lower()]["id"]
        try:
            # Fetch historical data for the specified number of days
            data = cg.get_coin_market_chart_by_id(id=coin_id, vs_currency="usd", days=days)
            prices = [(datetime.fromtimestamp(item[0]/1000).strftime("%Y-%m-%d"), item[1]) 
                      for item in data["prices"]]
            
            # Create DataFrame for prices and deviations
            df = pd.DataFrame(prices, columns=["Date", "Price"])
            df["Deviation (%)"] = (df["Price"] - 1.0) * 100
            
            # Convert to Markdown table
            markdown_table = df.to_markdown(index=False, floatfmt=".4f")
            return f"**{coin.upper()} Historical Data (Last {days} Days)**:\n\n{markdown_table}"
        except Exception as e:
            return f"Error fetching historical data for {coin}: {str(e)}"
  • main.py:15-84 (helper)
    Global dictionary mapping stablecoin symbols to their CoinGecko IDs and descriptions. Used by get_historical_data for validation and ID lookup.
    STABLECOINS = {
        "usdt": {
            "id": "tether",
            "description": "Tether's USD-pegged stablecoin, centrally issued."
        },
        "usdc": {
            "id": "usd-coin",
            "description": "Circle's USD-backed stablecoin, widely used in DeFi."
        },
        "dai": {
            "id": "dai",
            "description": "Decentralized stablecoin by MakerDAO, collateralized by crypto."
        },
        "busd": {
            "id": "binance-usd",
            "description": "Binance's USD-pegged stablecoin, centrally managed."
        },
        "tusd": {
            "id": "true-usd",
            "description": "TrueUSD, a USD-backed stablecoin by TrustToken."
        },
        "frax": {
            "id": "frax",
            "description": "Fractional-algorithmic USD stablecoin by Frax Finance."
        },
        "usdd": {
            "id": "usdd",
            "description": "TRON's USD-pegged stablecoin, centrally issued."
        },
        "usds": {
            "id": "usds",
            "description": "USD-pegged stablecoin, focused on stability."
        },
        "susds": {
            "id": "susds",
            "description": "Staked USDS, yield-bearing stablecoin."
        },
        "eusde": {
            "id": "ethena-staked-usde",
            "description": "Ethena's staked USD stablecoin, yield-bearing."
        },
        "usdy": {
            "id": "ondo-us-dollar-yield",
            "description": "Ondo's USD yield stablecoin, designed for returns."
        },
        "pyusd": {
            "id": "paypal-usd",
            "description": "PayPal's USD-pegged stablecoin for payments."
        },
        "gusd": {
            "id": "gemini-dollar",
            "description": "Gemini Dollar, USD-backed by Gemini Trust."
        },
        "usdp": {
            "id": "paxos-standard",
            "description": "Paxos Standard, a regulated USD stablecoin."
        },
        "aave-usdc": {
            "id": "aave-usdc",
            "description": "Aave's USD-pegged stablecoin for lending."
        },
        "curve-usd": {
            "id": "curve-usd",
            "description": "Curve Finance's USD stablecoin for DeFi pools."
        },
        "mim": {
            "id": "magic-internet-money",
            "description": "Magic Internet Money, a decentralized USD stablecoin."
        }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format but doesn't describe error conditions, rate limits, authentication requirements, data freshness, or what happens with invalid inputs. The description is minimal beyond basic functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by organized Args and Returns sections. Every sentence adds value with no redundant information, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 2-parameter tool with no annotations and no output schema, the description covers basic purpose and parameters adequately but lacks behavioral context. It doesn't explain error handling, data sources, or limitations that would help an agent use it correctly in various scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description provides essential parameter context: coin is a stablecoin symbol with examples, and days is optional with default value and meaning. This compensates well for the schema gap, though it doesn't specify constraints like valid coin values or day ranges.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Fetch historical price data'), target resource ('USD-pegged stablecoin'), and output format ('Markdown table'). It distinguishes from siblings like get_current_price (current vs historical) and analyze_peg_stability (analysis vs raw data).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for historical price data retrieval, but doesn't explicitly state when to use this tool versus alternatives like get_current_price or analyze_peg_stability. No guidance on prerequisites, limitations, or exclusion criteria is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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