Skip to main content
Glama
blockscout

Blockscout MCP Server

Official

lookup_token_by_symbol

Read-only

Find token addresses by searching with symbol or name. Returns multiple matches from blockchain data to help identify tokens.

Instructions

Search for token addresses by symbol or name. Returns multiple potential
matches based on symbol or token name similarity. Only the first
``TOKEN_RESULTS_LIMIT`` matches from the Blockscout API are returned.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYesThe ID of the blockchain
symbolYesToken symbol or name to search for

Implementation Reference

  • The core handler function that executes the lookup_token_by_symbol tool logic. It queries the Blockscout search API, processes results, limits to 7 items, and returns a ToolResponse with TokenSearchResult objects.
    @log_tool_invocation
    async def lookup_token_by_symbol(
        chain_id: Annotated[str, Field(description="The ID of the blockchain")],
        symbol: Annotated[str, Field(description="Token symbol or name to search for")],
        ctx: Context,
    ) -> ToolResponse[list[TokenSearchResult]]:
        """
        Search for token addresses by symbol or name. Returns multiple potential
        matches based on symbol or token name similarity. Only the first
        ``TOKEN_RESULTS_LIMIT`` matches from the Blockscout API are returned.
        """
        api_path = "/api/v2/search"
        params = {"q": symbol}
    
        await report_and_log_progress(
            ctx,
            progress=0.0,
            total=2.0,
            message=f"Starting token search for '{symbol}' on chain {chain_id}...",
        )
    
        base_url = await get_blockscout_base_url(chain_id)
    
        await report_and_log_progress(
            ctx,
            progress=1.0,
            total=2.0,
            message="Resolved Blockscout instance URL. Searching for tokens...",
        )
    
        response_data = await make_blockscout_request(base_url=base_url, api_path=api_path, params=params)
    
        await report_and_log_progress(
            ctx,
            progress=2.0,
            total=2.0,
            message="Successfully completed token search.",
        )
    
        all_items = response_data.get("items", [])
        notes = None
    
        if len(all_items) > TOKEN_RESULTS_LIMIT:
            notes = [
                (
                    f"The number of results exceeds the limit of {TOKEN_RESULTS_LIMIT}. "
                    f"Only the first {TOKEN_RESULTS_LIMIT} are shown."
                )
            ]
    
        items_to_process = all_items[:TOKEN_RESULTS_LIMIT]
    
        search_results = [
            TokenSearchResult(
                address=item.get("address_hash", ""),
                name=item.get("name", ""),
                symbol=item.get("symbol", ""),
                token_type=item.get("token_type", ""),
                total_supply=item.get("total_supply"),
                circulating_market_cap=item.get("circulating_market_cap"),
                exchange_rate=item.get("exchange_rate"),
                is_smart_contract_verified=item.get("is_smart_contract_verified", False),
                is_verified_via_admin_panel=item.get("is_verified_via_admin_panel", False),
            )
            for item in items_to_process
        ]
    
        return build_tool_response(data=search_results, notes=notes)
  • MCP tool registration for lookup_token_by_symbol, including annotations and structured_output=False.
    mcp.tool(
        structured_output=False,
        annotations=create_tool_annotations("Lookup Token by Symbol"),
    )(lookup_token_by_symbol)
  • Pydantic model defining the structure of each TokenSearchResult in the tool's output data list.
    # --- Model for lookup_token_by_symbol Data Payload ---
    class TokenSearchResult(BaseModel):
        """Represents a single token found by a search query."""
    
        address: str = Field(description="The contract address of the token.")
        name: str = Field(description="The full name of the token (e.g., 'USD Coin').")
        symbol: str = Field(description="The symbol of the token (e.g., 'USDC').")
        token_type: str = Field(description="The token standard (e.g., 'ERC-20').")
        total_supply: str | None = Field(description="The total supply of the token.")
        circulating_market_cap: str | None = Field(description="The circulating market cap, if available.")
        exchange_rate: str | None = Field(description="The current exchange rate, if available.")
        is_smart_contract_verified: bool = Field(description="Indicates if the token's contract is verified.")
        is_verified_via_admin_panel: bool = Field(description="Indicates if the token is verified by the Blockscout team.")
  • REST API route registration for the lookup_token_by_symbol tool endpoint (/v1/lookup_token_by_symbol).
    _add_v1_tool_route(mcp, "/lookup_token_by_symbol", lookup_token_by_symbol_rest)
  • REST wrapper function that calls the main tool handler with extracted parameters from the HTTP request.
    @handle_rest_errors
    async def lookup_token_by_symbol_rest(request: Request) -> Response:
        """REST wrapper for the lookup_token_by_symbol tool."""
        params = extract_and_validate_params(request, required=["chain_id", "symbol"], optional=[])
        tool_response = await lookup_token_by_symbol(**params, ctx=get_mock_context(request))
        return JSONResponse(tool_response.model_dump())
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, indicating a safe read operation. The description adds valuable behavioral context beyond annotations: it specifies that results are based on 'similarity' (not exact matches), returns 'multiple potential matches', and is limited by 'TOKEN_RESULTS_LIMIT' from the Blockscout API. This enhances transparency about output behavior and constraints, though it doesn't cover rate limits or error handling.

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 highly concise and well-structured in three sentences: it states the purpose, clarifies the return behavior (multiple matches based on similarity), and specifies the limitation (TOKEN_RESULTS_LIMIT from Blockscout API). Every sentence adds essential information without redundancy, making it efficient and front-loaded for quick comprehension.

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 the tool's moderate complexity (search with similarity matching), lack of output schema, and rich annotations (readOnlyHint, openWorldHint), the description is mostly complete. It covers key behavioral aspects like similarity-based matching and result limits, but doesn't explain the return format (e.g., what data fields are included) or potential errors, leaving some gaps in full contextual understanding.

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 description coverage is 100%, with clear descriptions for both parameters ('chain_id' as blockchain ID and 'symbol' as token symbol or name). The description adds minimal semantic value beyond the schema, only implying that 'symbol' is used for similarity-based searching. Since the schema already documents parameters well, the baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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

Purpose4/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: searching for token addresses by symbol or name and returning multiple potential matches. It specifies the verb ('Search for'), resource ('token addresses'), and scope ('by symbol or name'). However, it doesn't explicitly differentiate from sibling tools like 'get_tokens_by_address' or 'nft_tokens_by_address', which prevents a perfect score.

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 context by mentioning it returns matches based on 'symbol or token name similarity' and is limited to 'TOKEN_RESULTS_LIMIT' from the Blockscout API. However, it lacks explicit guidance on when to use this tool versus alternatives like 'get_tokens_by_address' or 'direct_api_call', and doesn't specify prerequisites or exclusions, leaving usage somewhat ambiguous.

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/blockscout/mcp-server'

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