Skip to main content
Glama

get_transaction_history

Retrieve detailed transaction history for any Stacks blockchain address with pagination controls to manage large datasets.

Instructions

Get detailed transaction history for a Stacks address with pagination support.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesStacks address to get transaction history for
limitNoNumber of transactions to retrieve (default: 20, max: 50)
offsetNoNumber of transactions to skip for pagination

Implementation Reference

  • Full implementation of the get_transaction_history tool handler, including description, parameters schema reference, and the execute function that fetches and formats transaction history using StacksApiService.
    export const getTransactionHistoryTool: Tool<undefined, typeof TransactionHistoryScheme> = {
      name: "get_transaction_history",
      description: "Get detailed transaction history for a Stacks address with pagination support.",
      parameters: TransactionHistoryScheme,
      execute: async (args, context) => {
        try {
          await recordTelemetry({ action: "get_transaction_history" }, context);
          
          const apiService = new StacksApiService();
          const network = (process.env.STACKS_NETWORK as "mainnet" | "testnet" | "devnet") || "mainnet";
          const limit = Math.min(args.limit || 20, 50); // Cap at 50
          const offset = args.offset || 0;
          
          const txData = await apiService.getAccountTransactions(args.address, network, limit, offset);
          const transactions = txData.results || [];
          
          if (!transactions || transactions.length === 0) {
            return `# Transaction History
    
    **Address**: ${args.address}
    **Result**: No transactions found.
    
    The address may be new or have no transaction activity yet.`;
          }
    
          let response = `# Transaction History
    
    **Address**: ${args.address}
    **Showing**: ${transactions.length} transactions (offset: ${offset})
    
    `;
    
          transactions.forEach((tx: any, index: number) => {
            const txNumber = offset + index + 1;
            const fee = (parseInt(tx.fee_rate || '0') / 1000000).toFixed(6);
            
            response += `## ${txNumber}. ${tx.tx_type.toUpperCase()} Transaction
    
    **Status**: ${tx.tx_status}
    **TX ID**: \`${tx.tx_id}\`
    **Block Height**: ${tx.block_height || 'Pending'}
    **Fee**: ${fee} STX
    **Nonce**: ${tx.nonce}
    
    `;
    
            // Add type-specific details
            if (tx.tx_type === 'token_transfer') {
              const amount = (parseInt(tx.token_transfer?.amount || '0') / 1000000).toFixed(6);
              response += `**Amount**: ${amount} STX
    **From**: ${tx.sender_address}
    **To**: ${tx.token_transfer?.recipient_address}
    **Memo**: ${tx.token_transfer?.memo || 'None'}
    
    `;
            } else if (tx.tx_type === 'contract_call') {
              response += `**Contract**: ${tx.contract_call?.contract_id}
    **Function**: ${tx.contract_call?.function_name}
    **Sender**: ${tx.sender_address}
    
    `;
            } else if (tx.tx_type === 'smart_contract') {
              response += `**Contract**: ${tx.smart_contract?.contract_id}
    **Source Code**: ${tx.smart_contract?.source_code ? 'Available' : 'Not available'}
    
    `;
            }
          });
    
          response += `\n## Pagination
    - **Current Offset**: ${offset}
    - **Results Per Page**: ${limit}
    - **Next Page**: Use offset ${offset + limit} to get more transactions
    
    Use \`get_stacks_account_info\` for account overview or specific transaction tools for detailed analysis.`;
    
          return response;
          
        } catch (error) {
          return `❌ Failed to get transaction history: ${error}`;
        }
      },
    };
  • Zod schema defining the input parameters for the get_transaction_history tool: address (required), limit and offset (optional).
    const TransactionHistoryScheme = z.object({
      address: z.string().describe("Stacks address to get transaction history for"),
      limit: z.number().optional().describe("Number of transactions to retrieve (default: 20, max: 50)"),
      offset: z.number().optional().describe("Number of transactions to skip for pagination"),
    });
  • Registration of the getTransactionHistoryTool with the FastMCP server in the central tools index.
    server.addTool(getTransactionHistoryTool);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'pagination support' which is useful, but fails to describe critical traits like whether this is a read-only operation, potential rate limits, authentication requirements, error conditions, or the format/structure of returned data. For a tool with 3 parameters and no output schema, this leaves significant gaps.

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?

The description is a single, efficient sentence that front-loads the core purpose and includes the key feature (pagination support). There's zero wasted language, and every word earns its place in conveying essential information.

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

Completeness2/5

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

Given the tool's complexity (3 parameters, no output schema, no annotations), the description is insufficiently complete. It doesn't explain what 'detailed transaction history' includes, the response format, error handling, or behavioral constraints. For a data retrieval tool with pagination, users need more context about what to expect from the output.

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?

Schema description coverage is 100%, with all parameters well-documented in the schema itself (address, limit with default/max, offset). The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline score of 3 for high schema coverage without adding extra value.

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

Purpose4/5

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

The description clearly states the action ('Get detailed transaction history') and resource ('for a Stacks address'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'get_stacks_account_info' or 'check_stx_balance' that might also provide transaction-related data, preventing a perfect score.

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 implies usage context by mentioning 'pagination support,' suggesting this tool is for retrieving multiple transactions. However, it provides no explicit guidance on when to use this versus alternatives like 'get_stacks_account_info' or 'analyze_transaction_post_conditions,' nor does it mention prerequisites or exclusions.

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/exponentlabshq/stacks-clarity-mcp'

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