Skip to main content
Glama
dewanshparashar

Arbitrum MCP Server

sync_status

Check synchronization status of Arbitrum nodes or retrieve the current block number if sync API is unavailable. Tool supports direct RPC URL input or defaults if configured.

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

  • Main MCP tool handler for 'sync_status': resolves RPC URL or chain name, instantiates NitroNodeClient, fetches sync status via getSyncStatus(), and returns JSON-formatted result.
    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), }, ], }; }
  • Tool schema definition in getAvailableTools(): defines name, description, and inputSchema (optional rpcUrl) for the 'sync_status' tool returned by list tools endpoint.
    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: [], }, },
  • src/index.ts:93-102 (registration)
    MCP server registration for list tools: handles ListToolsRequestSchema by returning all available tools including 'sync_status' from getAvailableTools().
    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; }
  • Core helper method implementing sync status logic: calls eth_syncing and eth_blockNumber RPC methods, computes progress, with fallback to current block if unsupported.
    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 SyncStatus response structure used by getSyncStatus() and returned by the tool.
    export interface SyncStatus { currentBlock: number; highestBlock: number; isSyncing: boolean; syncProgress: number; error?: string; }

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