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;
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations, the description carries full burden but only states 'Get recent transactions' without specifying behavior like pagination, rate limits, confirmation status, or what constitutes 'recent'. This leaves key behavioral traits unaddressed.

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?

A single, well-front-loaded sentence that conveys the purpose without fluff. Every word earns its place.

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?

Despite the simple interface, the lack of output schema and behavioral details means the description does not sufficiently inform an agent about what data to expect or how to handle results, leaving it incomplete for effective use.

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?

All parameters are described in the input schema with 100% coverage. The description adds no extra semantic meaning beyond the schema, aligning with the baseline score.

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 action ('Get') and resource ('recent transactions for an Ethereum address'), immediately distinguishing it from siblings like 'check-balance' or 'get-token-transfers'.

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?

No guidance is provided on when to use this tool versus alternatives such as 'get-token-transfers' for token-specific data or 'check-balance' for balances. Context for appropriate selection is missing.

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