# CoinMarketCap Trending Coins Tool

**CMC Trending Coins Tool (`cmc_trending_coins_tool`)**

Fetches a list of the top active cryptocurrencies ranked by market capitalization from the CoinMarketCap (CMC) Pro API, providing key market data for each.

{% hint style="info" %}
**Input:** Accepts an optional `limit` for the number of coins to retrieve.
{% endhint %}

```python
class CMCTrendingCoinsInput(BaseModel):
    limit: int = 20 # Number of coins (default 20, max 100)
```

***

**Key Functionality:**

* Retrieves a list of top cryptocurrencies (e.g., Bitcoin, Ethereum) sorted by market cap from the `pro-api.coinmarketcap.com`.
* For each coin, it provides its CMC rank, name, symbol, current price in USD, market capitalization, and 24-hour price change percentage.
* The number of results can be specified using `limit`, up to a maximum of 100.

***

**Sample Usage Queries (How an AI might use it):**

* "What are the top 10 cryptocurrencies by market cap from CoinMarketCap?"
* "Show me the leading 25 coins according to CMC."
* "Get CoinMarketCap's list of top cryptocurrencies."
* "List the top coins with a limit of 50 from CMC."
* "Which coins are currently at the top of CoinMarketCap rankings?"
* "Fetch the top 100 crypto listings from CMC."
* "Can you show me CoinMarketCap's main cryptocurrency list?"
* "What are the leading cryptocurrencies today via CMC?"

***

```python
class CMCTrendingCoinsTool(BaseTool):
    name: ClassVar[str] = "cmc_trending_coins_tool"
    description: ClassVar[str] = "Get a list of all active cryptocurrencies with latest market data from CoinMarketCap."
    args_schema: ClassVar[Type[BaseModel]] = CMCTrendingCoinsInput
```

***

**Important:**

* This tool operates **asynchronously** (`_arun`) only.
* Requires a valid CoinMarketCap Pro API Key (`CONFIG.CMC_API_KEY`) to be configured in the backend.
* The `limit` parameter defaults to 20 and is capped at a maximum of 100 coins.
