Skip to main content
Glama

get_swap_history

Retrieve swap transaction history from the Casper Network DEX. Filter by sender public key or trading pair to analyze past exchange activity.

Instructions

Get swap transaction history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
public_keyNoFilter by sender public key (hex)
pairNoFilter by pair contract package hash
pageNo
page_sizeNo

Implementation Reference

  • MCP tool handler for 'get_swap_history' that calls the SDK client.
    async (args) => {
      const result = await client.getSwapHistory({
        publicKey: args.public_key,
        pairContractPackageHash: args.pair,
        page: args.page,
        pageSize: args.page_size,
      });
      return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
    },
  • Registration of the 'get_swap_history' MCP tool.
    server.tool(
      'get_swap_history',
      'Get swap transaction history',
      {
        public_key: z.string().optional().describe('Filter by sender public key (hex)'),
        pair: z.string().optional().describe('Filter by pair contract package hash'),
        page: z.number().optional(),
        page_size: z.number().optional(),
      },
      async (args) => {
        const result = await client.getSwapHistory({
          publicKey: args.public_key,
          pairContractPackageHash: args.pair,
          page: args.page,
          pageSize: args.page_size,
        });
        return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }] };
      },
    );
  • SDK client implementation of getSwapHistory.
    async getSwapHistory(opts?: SwapHistoryQuery) {
      const accountHash = opts?.publicKey
        ? PublicKey.fromHex(opts.publicKey).accountHash().toHex()
        : undefined;
      return this.swapsApi.getSwaps({
        senderAccountHash: accountHash,
        pairContractPackageHash: opts?.pairContractPackageHash,
        page: opts?.page,
        pageSize: opts?.pageSize,
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but fails to specify read-only safety, result ordering (chronological?), supported time ranges, or pagination behavior (cursor vs offset). 'History' implies historical data but lacks specifics on data availability or immutability.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The four-word description is extremely brief with no wasted words, achieving high density. However, for a tool with four parameters including pagination controls, this brevity results in underspecification rather than efficient communication of essential operational details.

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 DeFi context with filtering and pagination complexity, and lacking both annotations and output schema, the description is incomplete. It omits return structure, default pagination limits, time range constraints, and sorting behavior—all critical for a history query tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 50% (page and page_size lack descriptions). The description makes no mention of pagination or filtering capabilities, failing to compensate for schema gaps. It adds no context for the 'pair' parameter format or expected public_key behavior beyond the schema's existing 'hex' and 'contract package hash' notes.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the basic action (Get) and resource (swap transaction history), but lacks specificity about the domain (DEX/DeFi) and does not differentiate from sibling query tools like get_liquidity_positions or get_pairs. It minimally expands the tool name without detailing scope or data sources.

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 provided on when to use this tool versus alternatives (e.g., get_pairs for current state vs historical swaps), nor does it explain the optional filtering pattern (all parameters are optional per schema). The pagination mechanism (page, page_size) is present but entirely undocumented.

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/make-software/cspr-trade-mcp'

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