Skip to main content
Glama

get_network_info

Retrieve current Solana network details including chain ID, version, and cluster information to verify blockchain connectivity and status.

Instructions

Get current network information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the get_network_info tool logic. It ensures the Solana connection is initialized, fetches the network version and epoch information, and returns details about the current network including RPC URL.
    async function handleGetNetworkInfo() { ensureConnection(); const version = await connection.getVersion(); const epochInfo = await connection.getEpochInfo(); return { network: currentNetwork, rpcUrl: NETWORKS[currentNetwork as keyof typeof NETWORKS], version: version["solana-core"], epoch: epochInfo.epoch, slotIndex: epochInfo.slotIndex, slotsInEpoch: epochInfo.slotsInEpoch }; }
  • src/index.ts:263-270 (registration)
    Registration of the get_network_info tool in the tools array used by ListToolsRequestSchema. Defines the tool name, description, and empty input schema (no parameters required).
    { name: "get_network_info", description: "Get current network information", inputSchema: { type: "object", properties: {} } },
  • src/index.ts:1321-1323 (registration)
    Dispatch logic in the CallToolRequestSchema handler's switch statement that maps the tool name to its handler function.
    case "get_network_info": result = await handleGetNetworkInfo(); break;
  • Helper constant defining Solana network RPC URLs, used by the handler to provide the current network's RPC endpoint.
    const NETWORKS = { mainnet: "https://api.mainnet-beta.solana.com", devnet: "https://api.devnet.solana.com", testnet: "https://api.testnet.solana.com", localhost: "http://127.0.0.1:8899"
  • Helper function called by the handler to lazily initialize the Solana connection if not already done.
    function ensureConnection() { if (!connectionInitialized) { initializeConnection(); connectionInitialized = true; } }

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

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