Skip to main content
Glama

get_transaction_history

Retrieve past bridge and swap transactions for a wallet address, including transaction IDs, statuses, chains, and timestamps with pagination support.

Instructions

Get past Relay bridge and swap transactions for a wallet address. Returns transaction IDs, statuses, chains, and timestamps. Supports pagination via cursor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userYesWallet address to look up.
limitNoMax number of transactions to return. Defaults to 10.
cursorNoPagination cursor from a previous response. Omit for the first page.

Implementation Reference

  • Main handler function that executes the get_transaction_history tool. Calls getRequests API, transforms the response data into a simplified transaction format (requestId, status, chains, txs, currency, createdAt), and returns formatted output with a summary and JSON data including pagination cursor.
    async ({ user, limit, cursor }) => {
      const result = await getRequests(user, limit, cursor);
    
      const txs = result.requests.map((r) => ({
        requestId: r.id,
        status: r.status,
        originChain: r.data.inTxs[0]?.chainId,
        destinationChain: r.data.outTxs[0]?.chainId,
        originTx: r.data.inTxs[0]?.hash,
        destinationTx: r.data.outTxs[0]?.hash,
        currency: r.data.currency,
        createdAt: r.createdAt,
      }));
    
      const summary = `Found ${txs.length} transaction${txs.length !== 1 ? "s" : ""} for ${user.slice(0, 6)}...${user.slice(-4)}.${result.continuation ? " More results available (use cursor to paginate)." : ""}`;
    
      return {
        content: [
          { type: "text", text: summary },
          {
            type: "text",
            text: JSON.stringify(
              { transactions: txs, cursor: result.continuation || null },
              null,
              2
            ),
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the get_transaction_history tool: 'user' (required wallet address), 'limit' (optional number, defaults to 10), and 'cursor' (optional pagination token).
    user: z.string().describe("Wallet address to look up."),
    limit: z
      .number()
      .optional()
      .default(10)
      .describe("Max number of transactions to return. Defaults to 10."),
    cursor: z
      .string()
      .optional()
      .describe(
        "Pagination cursor from a previous response. Omit for the first page."
      ),
  • Registration function that registers the get_transaction_history tool with the MCP server, including the tool name, description, input schema, and handler function.
    export function register(server: McpServer) {
      server.tool(
        "get_transaction_history",
        "Get past Relay bridge and swap transactions for a wallet address. Returns transaction IDs, statuses, chains, and timestamps. Supports pagination via cursor.",
        {
          user: z.string().describe("Wallet address to look up."),
          limit: z
            .number()
            .optional()
            .default(10)
            .describe("Max number of transactions to return. Defaults to 10."),
          cursor: z
            .string()
            .optional()
            .describe(
              "Pagination cursor from a previous response. Omit for the first page."
            ),
        },
        async ({ user, limit, cursor }) => {
          const result = await getRequests(user, limit, cursor);
    
          const txs = result.requests.map((r) => ({
            requestId: r.id,
            status: r.status,
            originChain: r.data.inTxs[0]?.chainId,
            destinationChain: r.data.outTxs[0]?.chainId,
            originTx: r.data.inTxs[0]?.hash,
            destinationTx: r.data.outTxs[0]?.hash,
            currency: r.data.currency,
            createdAt: r.createdAt,
          }));
    
          const summary = `Found ${txs.length} transaction${txs.length !== 1 ? "s" : ""} for ${user.slice(0, 6)}...${user.slice(-4)}.${result.continuation ? " More results available (use cursor to paginate)." : ""}`;
    
          return {
            content: [
              { type: "text", text: summary },
              {
                type: "text",
                text: JSON.stringify(
                  { transactions: txs, cursor: result.continuation || null },
                  null,
                  2
                ),
              },
            ],
          };
        }
      );
    }
  • Helper function getRequests that performs the actual API call to fetch transaction history. Accepts user address, limit, and optional continuation token, returns RequestsResponse with requests array and pagination cursor.
    export async function getRequests(
      user: string,
      limit = 10,
      continuation?: string
    ): Promise<RequestsResponse> {
      const params: Record<string, string> = {
        user,
        limit: String(limit),
      };
      if (continuation) params.continuation = continuation;
      return relayApi<RequestsResponse>("/requests", { params });
    }
  • TypeScript interfaces defining the data structures: RelayRequest (transaction data with id, status, user, inTxs, outTxs, currency, timestamps) and RequestsResponse (array of RelayRequest and optional continuation token for pagination).
    export interface RelayRequest {
      id: string;
      status: string;
      user: string;
      recipient: string;
      data: {
        inTxs: Array<{
          hash: string;
          chainId: number;
          timestamp: number;
        }>;
        outTxs: Array<{
          hash: string;
          chainId: number;
          timestamp: number;
        }>;
        currency: string;
        timeEstimate: number;
      };
      createdAt: string;
      updatedAt: string;
    }
    
    export interface RequestsResponse {
      requests: RelayRequest[];
      continuation?: string;
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral traits: it returns specific data fields (transaction IDs, statuses, chains, timestamps) and supports pagination via cursor. However, it doesn't mention rate limits, authentication requirements, error conditions, or whether this is a read-only operation (though 'Get' implies reading). The description adds value but doesn't fully compensate for the lack of 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?

The description is two sentences with zero waste: the first sentence states the purpose and return data, the second adds pagination support. It's front-loaded with the core functionality and efficiently structured without unnecessary details.

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

Completeness3/5

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

Given no annotations and no output schema, the description provides basic completeness for a read operation: it states what data is returned and mentions pagination. However, for a tool with 3 parameters and no structured output definition, it could benefit from more detail on response format, error handling, or limitations. It's adequate but has clear gaps in behavioral 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 already documents all three parameters thoroughly. The description adds minimal value beyond the schema: it mentions pagination via cursor, which is already covered in the cursor parameter description. No additional parameter semantics are provided, so the baseline score of 3 is appropriate when the schema does the heavy lifting.

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 verb ('Get') and resource ('past Relay bridge and swap transactions for a wallet address'), specifying the scope of transactions (bridge and swap) and the target (wallet address). It distinguishes from siblings like get_transaction_status (which checks individual transactions) and get_bridge_quote/get_swap_quote (which provide estimates rather than history).

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 for retrieving historical transaction data for a wallet, but doesn't explicitly state when to use this tool versus alternatives like get_transaction_status (for single transaction details) or other query tools. It mentions pagination support, which provides some context for handling large result sets, but lacks explicit guidance on use cases 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/relayprotocol/relay-mcp'

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