Skip to main content
Glama
0xsl1m

cerebrus-pulse-mcp

cerebrus_cex_dex

Compare Coinbase (CEX) and Chainlink/Uniswap (DEX) prices for any token. Returns spread in bps, direction, and interpretation. Cost $0.02 via x402.

Instructions

Get CEX-DEX price divergence for a token. Compares Coinbase (CEX) vs Chainlink/Uniswap (DEX) prices. Returns spread in bps, direction (cex_premium or dex_premium), and interpretation. Refreshes every 5 minutes. Cost: $0.02 USDC via x402.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin ticker (e.g., ETH, BTC, LINK). Case-insensitive.

Implementation Reference

  • Tool registration: cerebrus_cex_dex is registered as a Tool object with name='cerebrus_cex_dex', description about CEX-DEX price divergence, and inputSchema requiring a 'coin' string parameter.
    Tool(
        name="cerebrus_cex_dex",
        description=(
            "Get CEX-DEX price divergence for a token. Compares Coinbase (CEX) vs "
            "Chainlink/Uniswap (DEX) prices. Returns spread in bps, direction "
            "(cex_premium or dex_premium), and interpretation. "
            "Refreshes every 5 minutes. Cost: $0.02 USDC via x402."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "coin": {
                    "type": "string",
                    "description": "Coin ticker (e.g., ETH, BTC, LINK). Case-insensitive.",
                },
            },
            "required": ["coin"],
        },
    ),
  • Tool handler: when name == 'cerebrus_cex_dex', it validates the 'coin' argument via _validate_coin and calls _api_get(f'/cex-dex/{coin}') to fetch the CEX-DEX price divergence data from the backend API.
    elif name == "cerebrus_cex_dex":
        coin = _validate_coin(arguments["coin"])
        result = _api_get(f"/cex-dex/{coin}")
  • Helper function: _api_get makes the actual HTTP GET request to the Cerebrus Pulse API, handling 402 (payment required), 429 (rate limiting), and other HTTP errors.
    def _api_get(path: str, params: dict | None = None) -> dict[str, Any]:
        """Make a GET request to the Cerebrus Pulse API."""
        with _make_client() as client:
            resp = client.get(path, params=params)
    
            if resp.status_code == 402:
                # Return payment details so the agent/user knows cost
                return {
                    "status": "payment_required",
                    "message": "This endpoint requires x402 USDC payment on Base or Solana.",
                    "url": f"{BASE_URL}{path}",
                    "payment_details": resp.headers.get("X-Payment", "See x402 SDK docs"),
                    "help": "Install the x402 SDK and set CEREBRUS_WALLET_KEY (Base) or CEREBRUS_WALLET_KEY_SOLANA (Solana) to enable auto-payment. See https://cerebruspulse.xyz/guides/x402-payments",
                }
    
            if resp.status_code == 429:
                return {
                    "status": "rate_limited",
                    "message": "Rate limit exceeded. Back off and retry.",
                    "detail": resp.json() if resp.headers.get("content-type", "").startswith("application/json") else resp.text,
                }
    
            resp.raise_for_status()
            return resp.json()
  • Helper function: _make_client creates the httpx.Client configured with the base URL and timeout.
    def _make_client() -> httpx.Client:
        return httpx.Client(
            base_url=BASE_URL,
            timeout=REQUEST_TIMEOUT,
            headers={"User-Agent": f"cerebrus-pulse-mcp/{_VERSION}"},
        )
  • Helper function: _validate_coin validates and normalizes the coin ticker input (uppercased, regex-checked).
    def _validate_coin(coin: str) -> str:
        """Validate and normalize a coin ticker. Raises ValueError on bad input."""
        coin = coin.strip().upper()
        if not _COIN_RE.match(coin):
            raise ValueError(f"Invalid coin ticker: {coin!r}")
        return coin
Behavior4/5

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

With no annotations, description provides valuable behavioral details: refresh rate (5 min), cost ($0.02 USDC via x402), and return structure. This goes beyond the schema, though no rate limits or error handling are mentioned.

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?

Four sentences with no redundancy. Front-loaded with purpose, then adds refresh, cost, and return info efficiently.

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

Completeness5/5

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

For a simple tool with one parameter, the description covers purpose, sources, outputs, refresh, and cost. No gaps evident given lack of output schema.

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

Parameters3/5

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

Schema coverage is 100% and the description adds minimal extra meaning: it mentions comparing exchanges but doesn't constrain the coin parameter further. Baseline 3 is appropriate.

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?

Description clearly states the tool gets CEX-DEX price divergence, specifies sources (Coinbase vs Chainlink/Uniswap), and lists return values (spread in bps, direction, interpretation). It distinguishes from siblings like cerebrus_basis and cerebrus_spread.

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?

No explicit guidance on when to use this tool vs alternatives. The description implies usage for CEX-DEX divergence analysis but lacks exclusions or comparisons to sibling tools.

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

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/0xsl1m/cerebrus-pulse-mcp'

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