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
| Name | Required | Description | Default |
|---|---|---|---|
| blockNumOrHash | No | Block number or hash (defaults to 'latest') | |
| callArgs | Yes | Call arguments (to, from, data, etc.) | |
| chainName | No | Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL | |
| rpcUrl | No | The RPC URL of the Arbitrum node (optional if default is set) | |
| traceTypes | No | Array of trace types (e.g., ['trace', 'stateDiff']) |
Implementation Reference
- src/index.ts:465-482 (handler)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), }, ], };
- src/index.ts:1171-1203 (schema)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)}`); } } }