Skip to main content
Glama

get-transactions

Retrieve recent Ethereum transaction history for a specific address to monitor activity and track transfers on the OTC chain.

Instructions

Get recent transactions for an Ethereum address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEthereum address (0x format)
limitNoNumber of transactions to return (max 100)

Implementation Reference

  • Handler for executing the 'get-transactions' tool: validates input, fetches data from service, formats and returns response.
    if (name === "get-transactions") {
      try {
        const { address, limit } = TransactionHistorySchema.parse(args);
        const transactions = await etherscanService.getTransactionHistory(address, limit);
        const formattedTransactions = transactions.map(tx => {
          const date = new Date(tx.timestamp * 1000).toLocaleString();
          return `Block ${tx.blockNumber} (${date}):\n` +
                 `Hash: ${tx.hash}\n` +
                 `From: ${tx.from}\n` +
                 `To: ${tx.to}\n` +
                 `Value: ${tx.value} ETH\n` +
                 `---`;
        }).join('\n');
    
        const response = transactions.length > 0
          ? `Recent transactions for ${address}:\n\n${formattedTransactions}`
          : `No transactions found for ${address}`;
    
        return {
          content: [{ type: "text", text: response }],
        };
      } catch (error) {
        if (error instanceof z.ZodError) {
          throw new Error(`Invalid input: ${error.errors.map(e => e.message).join(", ")}`);
        }
        throw error;
      }
    }
  • Zod validation schema for 'get-transactions' tool inputs.
    const TransactionHistorySchema = z.object({
      address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'Invalid Ethereum address format'),
      limit: z.number().min(1).max(100).optional(),
    });
  • src/server.ts:70-90 (registration)
    Tool registration in listTools response, defining name, description, and input schema.
    {
      name: "get-transactions",
      description: "Get recent transactions for an Ethereum address",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "Ethereum address (0x format)",
            pattern: "^0x[a-fA-F0-9]{40}$"
          },
          limit: {
            type: "number",
            description: "Number of transactions to return (max 100)",
            minimum: 1,
            maximum: 100
          },
        },
        required: ["address"],
      },
    },
  • Core logic for fetching and formatting transaction history from Etherscan API.
    async getTransactionHistory(address: string, limit: number = 10): Promise<Transaction[]> {
      try {
        // Validate the address
        const validAddress = ethers.getAddress(address);
        
        // Get transactions directly from Etherscan API
        const result = await fetch(
          `https://api.etherscan.io/api?module=account&action=txlist&address=${validAddress}&startblock=0&endblock=99999999&page=1&offset=${limit}&sort=desc&apikey=${this.provider.apiKey}`
        );
        
        const data = await result.json();
        
        if (data.status !== "1" || !data.result) {
          throw new Error(data.message || "Failed to fetch transactions");
        }
    
        // Format the results
        return data.result.slice(0, limit).map((tx: any) => ({
          hash: tx.hash,
          from: tx.from,
          to: tx.to || 'Contract Creation',
          value: ethers.formatEther(tx.value),
          timestamp: parseInt(tx.timeStamp) || 0,
          blockNumber: parseInt(tx.blockNumber) || 0
        }));
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to get transaction history: ${error.message}`);
        }
        throw error;
      }
    }
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 'recent transactions' but doesn't specify time ranges, data sources, rate limits, error conditions, or what 'recent' means. This leaves significant gaps in understanding how the tool behaves beyond basic functionality.

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, clear sentence with zero wasted words. It's front-loaded with the core purpose, making it highly efficient and easy to parse for an AI agent.

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 complexity of blockchain data retrieval, no annotations, and no output schema, the description is incomplete. It lacks details on return format (e.g., transaction fields), pagination, error handling, or data freshness, which are critical for effective tool use in this context.

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%, so the schema fully documents both parameters (address format and limit constraints). The description adds no additional parameter semantics beyond implying the tool fetches transactions, which aligns with the schema. This meets the baseline for high schema coverage.

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') and resource ('recent transactions for an Ethereum address'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'get-token-transfers', which might also retrieve transaction data, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get-token-transfers' or 'check-balance'. It states what it does but offers no context about appropriate scenarios or exclusions, leaving the agent to infer usage.

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/otc-ai/mcp-otc'

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