Skip to main content
Glama
kukapay

crypto-pegmon-mcp

get_current_price

Fetch the current price of a USD-pegged stablecoin and calculate its peg deviation. Input the stablecoin symbol (e.g., 'usdt', 'usdc') to receive a Markdown-formatted response with price and deviation details.

Instructions

Fetch the current price of a USD-pegged stablecoin in USD and calculate peg deviation.

Args:
    coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai').

Returns:
    str: A string with the current price and peg deviation in Markdown format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYes

Implementation Reference

  • main.py:107-127 (handler)
    The handler function for the 'get_current_price' tool. It takes a stablecoin symbol, fetches its current USD price via CoinGecko API, computes the peg deviation from $1, and returns a formatted Markdown string with the price and deviation.
    def get_current_price(coin: str) -> str:
        """
        Fetch the current price of a USD-pegged stablecoin in USD and calculate peg deviation.
    
        Args:
            coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai').
    
        Returns:
            str: A string with the current price and peg deviation in Markdown format.
        """
        if coin.lower() not in STABLECOINS:
            return f"Error: Unsupported stablecoin. Choose from {list(STABLECOINS.keys())}"
        
        coin_id = STABLECOINS[coin.lower()]["id"]
        try:
            data = cg.get_price(ids=coin_id, vs_currencies="usd")
            price = data[coin_id]["usd"]
            deviation = (price - 1.0) * 100  # Calculate deviation as percentage
            return f"**{coin.upper()} Current Price**: ${price:.4f}, Peg Deviation: {deviation:.2f}%"
        except Exception as e:
            return f"Error fetching price for {coin}: {str(e)}"
  • main.py:106-106 (registration)
    The @mcp.tool() decorator registers the get_current_price function as an MCP tool. The tool name is the function name 'get_current_price'.
    @mcp.tool()
  • Docstring defining the input schema (coin: str parameter) and output format for the tool.
    """
    Fetch the current price of a USD-pegged stablecoin in USD and calculate peg deviation.
    
    Args:
        coin (str): The symbol of the stablecoin (e.g., 'usdt', 'usdc', 'dai').
    
    Returns:
        str: A string with the current price and peg deviation in Markdown format.
    """
  • main.py:15-83 (helper)
    Global STABLECOINS dictionary providing CoinGecko IDs for supported stablecoins, used by get_current_price to validate input and fetch data.
    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."
        }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the core behavior (fetching price and calculating deviation) and output format (Markdown string). However, it lacks details about data sources, rate limits, error conditions, or whether this is a read-only operation (though implied by 'fetch' and 'calculate').

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 dedicated 'Args' and 'Returns' sections. Every sentence adds value: the first states the tool's function, while the subsequent sections document parameters and output without redundancy.

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

Completeness4/5

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

For a single-parameter tool with no annotations or output schema, the description is reasonably complete. It covers the purpose, parameter semantics, and output format. However, it could improve by mentioning data sources or error handling, given the lack of structured fields.

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?

The schema description coverage is 0%, so the description must compensate. It provides clear semantics for the single parameter 'coin', including its type (str), purpose (stablecoin symbol), and examples ('usdt', 'usdc', 'dai'). This fully documents the parameter beyond the bare schema.

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 tool's purpose with specific verbs ('fetch', 'calculate') and resources ('current price of a USD-pegged stablecoin', 'peg deviation'). It distinguishes from sibling tools like 'get_historical_data' (historical vs current) and 'analyze_peg_stability' (stability analysis vs price fetching).

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

Usage Guidelines4/5

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

The description implies usage context through the parameter description ('symbol of the stablecoin') and mentions peg deviation calculation, which suggests it's for monitoring stablecoin pegs. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_supported_stablecoins' (list available coins) or 'analyze_peg_stability' (deeper analysis).

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