Skip to main content
Glama
dewanshparashar

Arbitrum MCP Server

arbtrace_call

Trace individual Arbitrum network calls by specifying trace types, RPC URLs, and call arguments to analyze transaction details and state changes.

Instructions

Trace individual calls with specified trace types (requires trace API)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumOrHashNoBlock number or hash (defaults to 'latest')
callArgsYesCall arguments (to, from, data, etc.)
chainNameNoChain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL
rpcUrlNoThe RPC URL of the Arbitrum node (optional if default is set)
traceTypesNoArray of trace types (e.g., ['trace', 'stateDiff'])

Implementation Reference

  • MCP server handler for the 'arbtrace_call' tool. Resolves the RPC URL from provided arguments or chain name, instantiates NitroNodeClient, invokes the traceCall method with callArgs, traceTypes, and blockNumOrHash, and returns the result as JSON-formatted text content.
    case "arbtrace_call": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const nodeClient = new NitroNodeClient(rpcUrl); const result = await nodeClient.traceCall( args.callArgs, (args.traceTypes as string[]) || ["trace"], args.blockNumOrHash as string ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], };
  • Input schema definition for the 'arbtrace_call' tool, specifying properties like rpcUrl, chainName, callArgs (required), traceTypes, and blockNumOrHash.
    name: "arbtrace_call", description: "Trace individual calls with specified trace types (requires trace API)", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the Arbitrum node (optional if default is set)", }, chainName: { type: "string", description: "Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL", }, callArgs: { type: "object", description: "Call arguments (to, from, data, etc.)", }, traceTypes: { type: "array", description: "Array of trace types (e.g., ['trace', 'stateDiff'])", items: { type: "string" }, }, blockNumOrHash: { type: "string", description: "Block number or hash (defaults to 'latest')", }, }, required: ["callArgs"], },
  • Helper function in NitroNodeClient that performs the actual RPC call to 'arbtrace_call' using makeRpcCall, handling errors and returning TraceResult.
    async traceCall( callArgs: any, traceTypes: string[], blockNumOrHash?: string ): Promise<TraceResult> { try { const traces = await this.makeRpcCall("arbtrace_call", [ callArgs, traceTypes, blockNumOrHash || "latest", ]); return { traces }; } catch (error) { return { traces: null, error: `Trace call not supported on this RPC endpoint: ${ (error as Error).message }`, }; } }
  • src/index.ts:93-102 (registration)
    Registration of the list tools handler which returns all available tools including 'arbtrace_call' via 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; }
  • Generic makeRpcCall helper method used by traceCall to send the JSON-RPC request to the Nitro node.
    private async makeRpcCall(method: string, params: any[]): Promise<any> { try { const requestBody = { jsonrpc: "2.0", id: Date.now(), method, params, }; console.error(`Making RPC call to ${this.rpcUrl}: ${method}`); const response = await fetch(this.rpcUrl, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(requestBody), }); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } const data = await response.json(); if (data.error) { throw new Error(`RPC Error: ${data.error.message}`); } return data.result; } catch (error) { console.error(`RPC call failed for ${method} on ${this.rpcUrl}:`, error); if (error instanceof Error) { throw error; } else { throw new Error(`Unknown error during RPC call: ${String(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