Skip to main content
Glama

get_chain_info

Retrieve detailed chain information for specified networks like BSC, Ethereum, and Base using the bnbchain-mcp server. Input network name or chain ID to fetch data.

Instructions

Get chain information for a specific network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet.bsc

Implementation Reference

  • Registration of the 'get_chain_info' tool including inline handler function that retrieves chainId, blockNumber, and rpcUrl using imported services.
    server.tool(
      "get_chain_info",
      "Get chain information for a specific network",
      {
        network: defaultNetworkParam
      },
      async ({ network }) => {
        try {
          const chainId = await services.getChainId(network)
          const blockNumber = await services.getBlockNumber(network)
          const rpcUrl = getRpcUrl(network)
    
          return mcpToolRes.success({
            network,
            chainId,
            blockNumber: blockNumber.toString(),
            rpcUrl
          })
        } catch (error) {
          return mcpToolRes.error(error, "fetching chain info")
        }
      }
    )
  • Zod schema definition for the 'network' input parameter used in get_chain_info tool.
    export const defaultNetworkParam = z
      .string()
      .describe(
        "Network name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet."
      )
      .default("bsc")
  • Helper function to get the current block number for a given network using viem's public client.
    export async function getBlockNumber(network = "ethereum"): Promise<bigint> {
      const client = getPublicClient(network)
      return await client.getBlockNumber()
    }
  • Helper function to get the chain ID for a given network using viem's public client.
    export async function getChainId(network = "ethereum"): Promise<number> {
      const client = getPublicClient(network)
      const chainId = await client.getChainId()
      return Number(chainId)
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information (implying read-only), but doesn't mention any behavioral traits like rate limits, authentication needs, error conditions, or what 'chain information' includes (e.g., network details, gas prices, chain ID). This is a significant gap for a tool with no annotation coverage.

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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with zero wasted content.

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

Completeness2/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 a single parameter with full schema coverage, the description is incomplete. It doesn't explain what 'chain information' entails (e.g., response format, data fields), behavioral aspects, or usage context relative to siblings, making it inadequate for an agent to fully understand the tool's operation.

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?

The schema description coverage is 100%, with the single parameter 'network' well-documented in the schema (including default value, examples, and description). The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline of 3 for high schema coverage.

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 verb 'Get' and the resource 'chain information for a specific network', which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_supported_networks' or 'get_latest_block', which could provide related network information.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_supported_networks' for listing networks or 'get_latest_block' for network-specific block data, leaving the agent to infer usage context.

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/bnb-chain/bnbchain-mcp'

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