Skip to main content
Glama
dewanshparashar

Arbitrum MCP Server

sync_status

Check Arbitrum node synchronization status to monitor chain health and verify data availability, with fallback to current block number when sync API is unavailable.

Instructions

Get node synchronization status (may fall back to current block number if sync API unavailable)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rpcUrlNoThe RPC URL of the Arbitrum node (optional if default is set)

Implementation Reference

  • MCP callTool handler case for the 'sync_status' tool. Resolves the RPC URL using chainName or rpcUrl, creates a NitroNodeClient instance, calls getSyncStatus() on it, and returns the result as JSON text content.
    case "sync_status": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const nodeClient = new NitroNodeClient(rpcUrl); const syncStatus = await nodeClient.getSyncStatus(); return { content: [ { type: "text", text: JSON.stringify(syncStatus, null, 2), }, ], }; }
  • Input schema and metadata definition for the 'sync_status' tool, registered in getAvailableTools() which is returned by the listTools handler.
    name: "sync_status", description: "Get node synchronization status (may fall back to current block number if sync API unavailable)", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the Arbitrum node (optional if default is set)", }, }, required: [], }, },
  • The core helper function implementing sync status logic. Calls eth_syncing and eth_blockNumber RPC methods, computes progress, with fallback to current block if syncing unavailable.
    async getSyncStatus(): Promise<SyncStatus> { try { const syncResponse = await this.makeRpcCall("eth_syncing", []); const latestBlock = await this.makeRpcCall("eth_blockNumber", []); if (syncResponse === false) { return { currentBlock: parseInt(latestBlock, 16), highestBlock: parseInt(latestBlock, 16), isSyncing: false, syncProgress: 100, }; } const current = parseInt(syncResponse.currentBlock, 16); const highest = parseInt(syncResponse.highestBlock, 16); return { currentBlock: current, highestBlock: highest, isSyncing: true, syncProgress: highest > 0 ? (current / highest) * 100 : 0, }; } catch (error) { // Try to get at least the current block number as a fallback try { const latestBlock = await this.makeRpcCall("eth_blockNumber", []); const blockNum = parseInt(latestBlock, 16); return { currentBlock: blockNum, highestBlock: blockNum, isSyncing: false, syncProgress: 100, error: "Sync status not supported on this RPC endpoint. Showing current block number only.", }; } catch (blockError) { return { currentBlock: 0, highestBlock: 0, isSyncing: false, syncProgress: 0, error: "Sync status not supported on this RPC endpoint. This method typically requires access to a node's debug API.", }; } } }
  • TypeScript interface defining the structure of the SyncStatus response object used by the tool.
    export interface SyncStatus { currentBlock: number; highestBlock: number; isSyncing: boolean; syncProgress: number; error?: string; }
  • src/index.ts:93-102 (registration)
    The listTools request handler that returns all available tools, including 'sync_status', via getAvailableTools() which contains its definition.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => { try { console.error("Handling list tools request"); return { tools: this.getAvailableTools(), }; } catch (error) { console.error("Error in list tools handler:", error); throw error; }

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/dewanshparashar/arbitrum-mcp'

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