Skip to main content
Glama
Bankless

Bankless Onchain MCP Server

Official
by Bankless

get_transaction_history_for_user

Retrieve detailed transaction history for a user, filtered by network, contract, or method ID, with options to include data and specify block range. Streamlines blockchain analysis and monitoring.

Instructions

Gets transaction history for a user and optional contract

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractNoThe contract address (optional)
includeDataNoWhether to include transaction data
methodIdNoThe method ID to filter by (optional)
networkYesThe blockchain network (e.g., "ethereum", "base")
startBlockNoThe starting block number (optional)
userYesThe user address

Implementation Reference

  • Core handler function that implements the tool logic by calling the Bankless API to fetch transaction history for a user.
    export async function getTransactionHistory(
        network: string,
        user: string,
        contract?: string | null,
        methodId?: string | null,
        startBlock?: string | null,
        includeData: boolean = true
    ): Promise<SimplifiedTransactionVO[]> {
        const token = process.env.BANKLESS_API_TOKEN;
    
        if (!token) {
            throw new BanklessAuthenticationError('BANKLESS_API_TOKEN environment variable is not set');
        }
    
        const endpoint = `${BASE_URL}/chains/${network}/transaction-history`;
    
        try {
            const response = await axios.post(
                endpoint,
                {
                    user,
                    contract,
                    methodId,
                    startBlock,
                    includeData
                },
                {
                    headers: {
                        'Content-Type': 'application/json',
                        'X-BANKLESS-TOKEN': `${token}`
                    }
                }
            );
    
            const data = Array.isArray(response.data) ? response.data : [];
    
            if (data.length > 10000) {
                throw new BanklessValidationError(`too many results, try again with a more specific query`);
            }
    
            return data;
        } catch (error) {
            if (axios.isAxiosError(error)) {
                const statusCode = error.response?.status || 'unknown';
                const errorMessage = error.response?.data?.message || error.message;
    
                if (statusCode === 401 || statusCode === 403) {
                    throw new BanklessAuthenticationError(`Authentication Failed: ${errorMessage}`);
                } else if (statusCode === 404) {
                    throw new BanklessResourceNotFoundError(`Not Found: ${errorMessage}`);
                } else if (statusCode === 422) {
                    throw new BanklessValidationError(`Validation Error: ${errorMessage}`, error.response?.data);
                } else if (statusCode === 429) {
                    // Extract reset timestamp or default to 60 seconds from now
                    const resetAt = new Date();
                    resetAt.setSeconds(resetAt.getSeconds() + 60);
                    throw new BanklessRateLimitError(`Rate Limit Exceeded: ${errorMessage}`, resetAt);
                }
    
                throw new Error(`Bankless API Error (${statusCode}): ${errorMessage}`);
            }
            throw new Error(`Failed to get transaction history: ${error instanceof Error ? error.message : String(error)}`);
        }
    }
  • Zod schema defining the input parameters for the get_transaction_history_for_user tool.
    export const TransactionHistorySchema = z.object({
        network: z.string().describe('The blockchain network (e.g., "ethereum", "base")'),
        user: z.string().describe('The user address'),
        contract: z.string().nullable().optional().describe('The contract address (optional)'),
        methodId: z.string().nullable().optional().describe('The method ID to filter by (optional)'),
        startBlock: z.string().nullable().optional().describe('The starting block number (optional)'),
        includeData: z.boolean().default(true).describe('Whether to include transaction data')
    });
  • src/index.ts:111-115 (registration)
    Tool registration in the ListTools response, including name, description, and input schema reference.
    {
        name: "get_transaction_history_for_user",
        description: "Gets transaction history for a user and optional contract",
        inputSchema: zodToJsonSchema(transactions.TransactionHistorySchema),
    },
  • Dispatch handler in the main server that parses arguments and delegates to the core implementation.
    case "get_transaction_history_for_user": {
        const args = transactions.TransactionHistorySchema.parse(request.params.arguments);
        const result = await transactions.getTransactionHistory(
            args.network,
            args.user,
            args.contract,
            args.methodId,
            args.startBlock,
            args.includeData
        );
        return {
            content: [{type: "text", text: JSON.stringify(result, null, 2)}],
        };
    }
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 only states what the tool does ('Gets transaction history') without mentioning any behavioral traits such as rate limits, authentication needs, error handling, or what the output format looks like. This is inadequate for a tool with multiple parameters and no output schema.

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 that efficiently conveys the core purpose without any wasted words. It's front-loaded with the main action and resource, making it easy to parse quickly.

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 6 parameters, no annotations, and no output schema, the description is incomplete. It fails to address key contextual elements like what 'transaction history' entails, how results are returned (e.g., pagination, format), or any limitations, leaving significant gaps for the agent to navigate.

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?

The schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds no additional meaning beyond the schema, such as explaining interactions between parameters or providing examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 tool's purpose with a specific verb ('Gets') and resource ('transaction history for a user and optional contract'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_transaction_info' or 'get_events', which might also retrieve transaction-related data, so it falls short of 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 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. It doesn't mention sibling tools like 'get_transaction_info' or 'get_events', nor does it specify prerequisites or contexts for usage, leaving the agent to infer based on the tool name alone.

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

Related 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/Bankless/onchain-mcp'

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