Skip to main content
Glama

getChainsByKeyword

Search for blockchain networks using keywords to find matching chains with details like Chain ID, RPC endpoints, and explorers.

Instructions

Retrieve information about blockchains matching a keyword (case-insensitive partial match), returned as Markdown.

**Parameters**:
- `keyword` (string): The keyword or partial name of the blockchain to search for (e.g., 'eth' for Ethereum).
- `limit` (integer, optional): Maximum number of matching chains to return (default: 5).

**Returns**:
- A Markdown-formatted string listing up to `limit` matching chains with their details (Name, Chain ID, Native Currency, TVL, RPC Endpoints, Explorers) or an error message if no chains are found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes
limitNo

Implementation Reference

  • main.py:83-110 (handler)
    The handler function decorated with @mcp.tool(), implementing the core logic: fetches chains, filters by keyword using regex (case-insensitive), limits results, formats output as Markdown using format_chain_as_markdown.
    @mcp.tool()
    async def getChainsByKeyword(keyword: str, limit: int = 5) -> str:
        """
        Retrieve information about blockchains matching a keyword (case-insensitive partial match), returned as Markdown.
    
        **Parameters**:
        - `keyword` (string): The keyword or partial name of the blockchain to search for (e.g., 'eth' for Ethereum).
        - `limit` (integer, optional): Maximum number of matching chains to return (default: 5).
    
        **Returns**:
        - A Markdown-formatted string listing up to `limit` matching chains with their details (Name, Chain ID, Native Currency, TVL, RPC Endpoints, Explorers) or an error message if no chains are found.
        """
        chains = await fetch_chain_data()
        pattern = re.escape(keyword.strip())
        matches: List[Dict[str, Any]] = []
        
        for chain in chains:
            chain_name = chain.get("name", "")
            if re.search(pattern, chain_name, re.IGNORECASE):
                matches.append(chain)
        
        if matches:
            output = "**Matching Chains**\n\n"
            # Apply limit to matches
            for i, chain in enumerate(matches[:limit], 1):
                output += f"### Chain {i}\n{format_chain_as_markdown(chain)}\n"
            return output
        return f"**Error**: No chains found matching keyword '{keyword}'"
  • main.py:14-22 (helper)
    Helper function to fetch and cache the chain data from the Chainlist API, used by getChainsByKeyword.
    async def fetch_chain_data() -> list[Dict[str, Any]]:
        """Fetch and cache chain data from Chainlist API."""
        global chain_data
        if chain_data is None:
            async with httpx.AsyncClient() as client:
                response = await client.get("https://chainlist.org/rpcs.json")
                response.raise_for_status()
                chain_data = response.json()
        return chain_data
  • main.py:24-64 (helper)
    Helper function to format a single chain's details as Markdown with tables for RPCs and explorers, called by getChainsByKeyword.
    def format_chain_as_markdown(chain: Dict[str, Any]) -> str:
        """
        Format a single chain's details as Markdown, extracting specified fields with RPC and Explorers as tables.
        """
        # Extract required fields
        name = chain.get('name', 'N/A')
        chain_id = chain.get('chainId', 'N/A')
        native_currency = chain.get('nativeCurrency', {})
        tvl = chain.get('tvl', 'N/A')
        rpc_list = chain.get('rpc', [])
        explorers_list = chain.get('explorers', [])
    
        # Format native currency
        currency_info = f"{native_currency.get('name', 'N/A')} ({native_currency.get('symbol', 'N/A')}, {native_currency.get('decimals', 'N/A')} decimals)" if native_currency else 'N/A'
    
        # Format RPC list as a table
        rpc_data = [[rpc.get('url', 'N/A'), rpc.get('tracking', 'N/A')] for rpc in rpc_list]
        rpc_output = "**RPC Endpoints**:\n"
        if rpc_data:
            rpc_output += tabulate(rpc_data, headers=["URL", "Tracking"], tablefmt="pipe")
        else:
            rpc_output += "None"
    
        # Format explorers list as a table
        explorers_data = [[explorer.get('name', 'N/A'), explorer.get('url', 'N/A'), explorer.get('standard', 'N/A')] for explorer in explorers_list]
        explorers_output = "**Explorers**:\n"
        if explorers_data:
            explorers_output += tabulate(explorers_data, headers=["Name", "URL", "Standard"], tablefmt="pipe")
        else:
            explorers_output += "None"
    
        # Combine all fields
        return f"""**Chain Details**
    - **Name**: {name}
    - **Chain ID**: {chain_id}
    - **Native Currency**: {currency_info}
    - **TVL**: {tvl}
    {rpc_output}
    
    {explorers_output}
    """
  • main.py:83-83 (registration)
    Registration of the tool using FastMCP's @mcp.tool() decorator.
    @mcp.tool()
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: case-insensitive partial matching, Markdown return format, default limit value, and error handling for no matches. It doesn't mention rate limits, authentication needs, or pagination, but covers essential operational traits adequately.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The parameter and return sections are well-structured with bullet points, and every sentence adds value 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?

Given no annotations, no output schema, and 0% schema coverage, the description provides good completeness: it explains purpose, parameters, return format, and error cases. However, it doesn't detail the exact structure of the Markdown output (e.g., field order or formatting specifics), leaving minor gaps.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It provides detailed semantics for both parameters: 'keyword' is explained with examples and matching behavior, and 'limit' specifies optionality, default value, and purpose. This adds substantial meaning 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 a specific verb ('Retrieve information about blockchains') and resource ('blockchains matching a keyword'), distinguishing it from the sibling tool 'getChainById' which presumably retrieves by ID rather than keyword. It specifies case-insensitive partial matching and Markdown formatting.

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 provides clear context for when to use this tool (searching by keyword/partial name) and implies usage vs. 'getChainById' (keyword vs. ID). However, it doesn't explicitly state when NOT to use it or name alternatives beyond the sibling tool, missing explicit exclusions.

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/kukapay/chainlist-mcp'

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