Skip to main content
Glama

t2000_exchange

Swap assets on Cetus DEX to exchange tokens like USDC and SUI. Get quotes or execute trades with configurable slippage.

Instructions

Swap assets via Cetus DEX (e.g. USDC to SUI, SUI to USDC). Amount is in source asset units. Set dryRun: true to get a quote without executing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount to swap (in source asset units)
fromYesSource asset (e.g. USDC, SUI)
toYesTarget asset (e.g. SUI, USDC)
maxSlippageNoMax slippage percentage (default: 3%)
dryRunNoPreview without signing (default: false)

Implementation Reference

  • The implementation of the 't2000_exchange' tool, which handles asset swaps via the Cetus DEX, including dry-run quoting and actual execution.
    server.tool(
      't2000_exchange',
      'Swap assets via Cetus DEX (e.g. USDC to SUI, SUI to USDC). Amount is in source asset units. Set dryRun: true to get a quote without executing.',
      {
        amount: z.number().describe('Amount to swap (in source asset units)'),
        from: z.string().describe('Source asset (e.g. USDC, SUI)'),
        to: z.string().describe('Target asset (e.g. SUI, USDC)'),
        maxSlippage: z.number().optional().describe('Max slippage percentage (default: 3%)'),
        dryRun: z.boolean().optional().describe('Preview without signing (default: false)'),
      },
      async ({ amount, from, to, maxSlippage, dryRun }) => {
        try {
          if (dryRun) {
            agent.enforcer.assertNotLocked();
            const quote = await agent.exchangeQuote({ from, to, amount });
    
            return {
              content: [{
                type: 'text',
                text: JSON.stringify({
                  preview: true,
                  from,
                  to,
                  amount,
                  expectedOutput: quote.expectedOutput,
                  priceImpact: quote.priceImpact,
                  fee: quote.fee.amount,
                }),
              }],
            };
          }
    
          const result = await mutex.run(() =>
            agent.exchange({ from, to, amount, maxSlippage }),
          );
          return { content: [{ type: 'text', text: JSON.stringify(result) }] };
        } catch (err) {
          return errorResult(err);
        }
      },
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it's a swap operation (implying a write/mutation), includes a dry-run option for previews, and specifies amount units. However, it misses details like authentication requirements, rate limits, transaction costs, or what happens on execution failure, which are important for a financial tool.

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 efficiently structured in two sentences: the first states the core purpose with examples, and the second adds crucial usage guidance for dryRun. Every sentence earns its place with no wasted words, making it easy to scan and understand quickly.

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 the tool's complexity (financial swap with 5 parameters) and lack of annotations and output schema, the description is somewhat incomplete. It covers the basic operation and dry-run feature but omits details on return values, error handling, or dependencies (e.g., needing sufficient balance). For a tool with no structured safety or output info, more context would be beneficial.

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 parameters thoroughly. The description adds minimal value beyond the schema by reiterating amount units and the dryRun purpose, but doesn't provide additional semantics like format examples for 'from'/'to' or slippage implications. Baseline 3 is appropriate given high schema coverage.

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 tool's purpose with specific verbs ('Swap assets') and resources ('via Cetus DEX'), providing concrete examples (e.g., USDC to SUI). It distinguishes itself from siblings like t2000_balance or t2000_send by focusing on asset exchange rather than balance checking or transfers.

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

Usage Guidelines4/5

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

The description provides clear context for usage by mentioning the Cetus DEX and including a practical tip (dryRun for quotes). However, it lacks explicit guidance on when to use this tool versus alternatives like t2000_rates for checking rates or t2000_auto_invest for automated investing, which would be helpful for sibling differentiation.

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/mission69b/t2000'

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