Skip to main content
Glama

azeth_history

Retrieve transaction history for Azeth smart accounts to review past payments, verify transfers, and audit on-chain activity.

Instructions

Get recent transaction history for your Azeth smart account.

Use this when: You need to review past transactions, verify a payment was sent, or audit account activity.

Returns: Array of transaction records with hash, from, to, value, block number, and timestamp.

Note: Full indexed history requires the Azeth server to be running. Returns empty results if the server is unavailable. The account is determined by the AZETH_PRIVATE_KEY environment variable.

Example: { "limit": 5 } or { "smartAccount": "#2", "limit": 20 }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoTarget chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").
limitNoMaximum number of transactions to return. Defaults to 10.
smartAccountNoSmart account address, name, or "#N" (account index). If omitted, uses your first smart account.

Implementation Reference

  • The handler for the azeth_history tool.
    async (args) => {
      let client;
      try {
        client = await createClient(args.chain);
    
        // Resolve smartAccount: address, name, "#N", or undefined
        let forAccount: `0x${string}` | undefined;
        if (args.smartAccount) {
          try {
            forAccount = await resolveSmartAccount(args.smartAccount, client);
          } catch (resolveErr) {
            return handleError(resolveErr);
          }
        }
    
        const history = await client.getHistory({ limit: args.limit ?? 10 }, forAccount);
    
        // Resolve token symbols and decimals for formatting
        const chain = resolveChain(args.chain);
        const tokens = TOKENS[chain];
        const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
    
        return success({
          smartAccount: client.smartAccount ?? 'not-deployed',
          transactions: history.map((tx) => {
            // Determine token symbol and decimals for formatting
            const tokenAddr = tx.token?.toLowerCase() ?? null;
            let symbol = 'ETH';
            let decimals = 18;
            if (tokenAddr && tokenAddr !== ZERO_ADDR) {
              if (tokenAddr === tokens.USDC.toLowerCase()) {
                symbol = 'USDC';
                decimals = 6;
              } else if (tokenAddr === tokens.WETH.toLowerCase()) {
                symbol = 'WETH';
                decimals = 18;
              } else {
                symbol = 'TOKEN';
              }
            }
    
            const valueFormatted = `${formatTokenAmount(tx.value, decimals, decimals === 6 ? 2 : 6)} ${symbol}`;
            const timestampISO = tx.timestamp > 0
              ? new Date(tx.timestamp * 1000).toISOString()
              : null;
    
            return {
              hash: tx.hash,
              from: tx.from,
              to: tx.to,
              value: tx.value.toString(),
              valueFormatted,
              token: tx.token ?? ZERO_ADDR,
              tokenSymbol: symbol,
              blockNumber: tx.blockNumber.toString(),
              timestamp: tx.timestamp,
              timestampISO,
            };
          }),
        });
      } catch (err) {
        return handleError(err);
      } finally {
        try { await client?.destroy(); } catch (e) { process.stderr.write(`[azeth-mcp] destroy error: ${e instanceof Error ? e.message : String(e)}\n`); }
      }
  • The input schema validation for azeth_history.
    inputSchema: z.object({
      chain: z.string().optional().describe('Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").'),
      limit: z.coerce.number().int().min(1).max(100).optional().describe('Maximum number of transactions to return. Defaults to 10.'),
      smartAccount: z.string().optional().describe('Smart account address, name, or "#N" (account index). If omitted, uses your first smart account.'),
    }),
  • Registration of the azeth_history tool.
    server.registerTool(
      'azeth_history',
      {
        description: [
          'Get recent transaction history for your Azeth smart account.',
          '',
          'Use this when: You need to review past transactions, verify a payment was sent, or audit account activity.',
          '',
          'Returns: Array of transaction records with hash, from, to, value, block number, and timestamp.',
          '',
          'Note: Full indexed history requires the Azeth server to be running. Returns empty results if the server is unavailable.',
          'The account is determined by the AZETH_PRIVATE_KEY environment variable.',
          '',
          'Example: { "limit": 5 } or { "smartAccount": "#2", "limit": 20 }',
        ].join('\n'),
        inputSchema: z.object({
          chain: z.string().optional().describe('Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet").'),
          limit: z.coerce.number().int().min(1).max(100).optional().describe('Maximum number of transactions to return. Defaults to 10.'),
          smartAccount: z.string().optional().describe('Smart account address, name, or "#N" (account index). If omitted, uses your first smart account.'),
        }),
      },

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/azeth-protocol/mcp-azeth'

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