Skip to main content
Glama

Get Transaction Trace

get-tx-trace
Read-onlyIdempotent

Trace internal calls for a transaction hash to view internal transfers, contract calls, and token movements. Requires OPENPULSECHAIN_API_KEY.

Instructions

[PRO] Internal call trace for a transaction hash. Shows all internal transfers, contract calls, and token movements. Requires OPENPULSECHAIN_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tx_hashYesTransaction hash (0x...)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
transactionYes
internal_transactionsYes

Implementation Reference

  • Tool 'get-tx-trace' registered via server.registerTool with schema description, input/output validation, and the proGate-wrapped handler.
    server.registerTool(
      'get-tx-trace',
      {
        title: 'Get Transaction Trace',
        description: '[PRO] Internal call trace for a transaction hash. Shows all internal transfers, contract calls, and token movements. Requires OPENPULSECHAIN_API_KEY.',
        inputSchema: {
          tx_hash: z.string().describe('Transaction hash (0x...)'),
        },
        outputSchema: z.object({
          transaction: z.object({
            hash: z.string(),
            from: z.string(),
            to: z.string(),
            value: z.string(),
          }).passthrough(),
          internal_transactions: z.array(z.object({
            from: z.string(),
            to: z.string(),
            value: z.string(),
            type: z.string(),
          }).passthrough()),
        }).passthrough(),
        annotations: READ_ONLY_ANNOTATIONS,
      },
      proGate<{ tx_hash: string }>(async ({ tx_hash }) => {
        const clean = tx_hash.trim().toLowerCase()
        if (!/^0x[0-9a-f]{64}$/.test(clean)) throw new Error('Invalid transaction hash')
        const data = await fetchJSON(`${SAFETY}/api/v1/tx/${clean}/trace`)
        return wrapResult(data)
      })
    )
  • The actual handler logic: validates transaction hash format (0x + 64 hex chars), then calls safety.openpulsechain.com/api/v1/tx/{hash}/trace and wraps the result.
    proGate<{ tx_hash: string }>(async ({ tx_hash }) => {
      const clean = tx_hash.trim().toLowerCase()
      if (!/^0x[0-9a-f]{64}$/.test(clean)) throw new Error('Invalid transaction hash')
      const data = await fetchJSON(`${SAFETY}/api/v1/tx/${clean}/trace`)
      return wrapResult(data)
    })
  • Input/output schema definitions. Input: tx_hash (string). Output: transaction object + internal_transactions array.
    inputSchema: {
      tx_hash: z.string().describe('Transaction hash (0x...)'),
    },
    outputSchema: z.object({
      transaction: z.object({
        hash: z.string(),
        from: z.string(),
        to: z.string(),
        value: z.string(),
      }).passthrough(),
      internal_transactions: z.array(z.object({
        from: z.string(),
        to: z.string(),
        value: z.string(),
        type: z.string(),
      }).passthrough()),
    }).passthrough(),
  • Generic fetchJSON helper used to make the API call to the safety backend with timeout.
    async function fetchJSON(url: string): Promise<any> {
      const headers: Record<string, string> = { 'Accept': 'application/json' }
      if (HAS_API_KEY) headers['Authorization'] = `Bearer ${API_KEY}`
      const controller = new AbortController()
      const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS)
      try {
        const res = await fetch(url, { headers, signal: controller.signal })
        if (!res.ok) {
          if (res.status === 401 || res.status === 403) {
            throw new Error(
              `API ${res.status}: This endpoint requires a valid API key. ` +
              `Get one at ${PRICING_URL}`
            )
          }
          throw new Error(`API request failed with status ${res.status}`)
        }
        return res.json()
      } finally {
        clearTimeout(timer)
      }
    }
  • proGate wrapper that gates PRO-tier tools behind an API key check. If no key is configured, returns a pro_tier_required error.
    function proGate<Args>(
      handler: (args: Args) => Promise<ToolResult>
    ): (args: Args) => Promise<ToolResult> {
      return async (args: Args) => {
        if (!HAS_API_KEY) {
          const errorPayload = {
            error: 'pro_tier_required',
            message:
              'This tool is part of the OpenPulsechain MCP Pro tier. ' +
              'Set the OPENPULSECHAIN_API_KEY environment variable to unlock it.',
            upgrade_url: PRICING_URL,
            how_to:
              'In your Claude/Cursor/Claude-Code MCP config, add: ' +
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, destructiveHint false, idempotentHint true, and openWorldHint true. The description adds value by specifying the exact contents (internal transfers, contract calls, token movements) and that it's a PRO feature, which beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. The first sentence defines the purpose and output scope; the second provides the key prerequisite. Front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has an output schema (not shown), so the description does not need to detail returns. It covers purpose, scope, and authentication requirement. Given the annotations and schema richness, the description is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage for the single parameter tx_hash with a description 'Transaction hash (0x...)'. The description does not add any additional meaning or constraints beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool provides an internal call trace for a transaction hash, including all internal transfers, contract calls, and token movements. It distinguishes itself from siblings like get-wallet-transactions or get-token-history by focusing on internal trace details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the requirement for an OPENPULSECHAIN_API_KEY, giving a prerequisite. However, it does not provide guidance on when to use this tool versus alternatives (e.g., get-token-history for token movements or get-wallet-transactions for external transfers).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/openpulsechain/public'

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