Skip to main content
Glama

menese_swap

Swap tokens across 19 blockchain networks using native DEX protocols. Supports Ethereum, Solana, ICP, SUI, Cardano, XRP, and other chains with quote and execute modes.

Instructions

Swap tokens via DEX on supported chains. EVM: Uniswap V3 | Solana: Raydium | ICP: ICPSwap/KongSwap | SUI: Cetus | Cardano: Minswap | XRP: XRPL DEX.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesChain to swap on
fromTokenYesSource token symbol or address
toTokenYesDestination token symbol or address
amountYesAmount of fromToken to swap (decimal)
slippageBpsNoSlippage tolerance in basis points (default 250 = 2.5%)
modeNo'quote' to preview swap, 'execute' to swap. Default: execute

Implementation Reference

  • The registerSwapTool function contains the server.registerTool definition for "menese_swap".
    export function registerSwapTool(
      server: McpServer,
      store: IdentityStore,
      config: MeneseConfig,
    ): void {
      server.registerTool(
        "menese_swap",
        {
          description:
            "Swap tokens via DEX on supported chains. " +
            "EVM: Uniswap V3 | Solana: Raydium | ICP: ICPSwap/KongSwap | SUI: Cetus | " +
            "Cardano: Minswap | XRP: XRPL DEX.",
          inputSchema: {
            chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).describe("Chain to swap on"),
            fromToken: z.string().describe("Source token symbol or address"),
            toToken: z.string().describe("Destination token symbol or address"),
            amount: z.string().describe("Amount of fromToken to swap (decimal)"),
            slippageBps: z.number().min(1).max(5000).optional()
              .describe("Slippage tolerance in basis points (default 250 = 2.5%)"),
            mode: z.enum(["quote", "execute"]).optional()
              .describe("'quote' to preview swap, 'execute' to swap. Default: execute"),
          },
        },
        async ({ chain, fromToken, toToken, amount, slippageBps, mode }) => {
          const identity = store.get();
          if (!identity) {
            return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
          }
    
          const guard = checkGuard("menese_swap", { chain, fromToken, toToken, amount, slippageBps, mode }, config);
          if (!guard.allowed) {
            return { content: [{ type: "text" as const, text: guard.reason! }], isError: true };
          }
    
          if (mode === "quote") {
            return {
              content: [{
                type: "text" as const,
                text: `Ready to swap ${amount} ${fromToken} → ${toToken} on ${chain} (slippage: ${slippageBps ?? 250}bps). Call again with mode "execute" to confirm.`,
              }],
            };
          }
    
          const result = await swapTokensOnChain(config, resolveActorIdentity(store), {
            chain, fromToken, toToken, amount, slippageBps,
          });
    
          if (result.ok) {
            invalidateBalanceCaches(store.getPrincipal()!);
          }
    
          return {
            content: [{
              type: "text" as const,
              text: JSON.stringify(result, bigIntReplacer, 2),
            }],
          };
        },
      );
    }
  • The async handler function for "menese_swap", which processes quotes and executes swaps.
    async ({ chain, fromToken, toToken, amount, slippageBps, mode }) => {
      const identity = store.get();
      if (!identity) {
        return { content: [{ type: "text" as const, text: "No wallet configured. Use menese_setup first." }], isError: true };
      }
    
      const guard = checkGuard("menese_swap", { chain, fromToken, toToken, amount, slippageBps, mode }, config);
      if (!guard.allowed) {
        return { content: [{ type: "text" as const, text: guard.reason! }], isError: true };
      }
    
      if (mode === "quote") {
        return {
          content: [{
            type: "text" as const,
            text: `Ready to swap ${amount} ${fromToken} → ${toToken} on ${chain} (slippage: ${slippageBps ?? 250}bps). Call again with mode "execute" to confirm.`,
          }],
        };
      }
    
      const result = await swapTokensOnChain(config, resolveActorIdentity(store), {
        chain, fromToken, toToken, amount, slippageBps,
      });
    
      if (result.ok) {
        invalidateBalanceCaches(store.getPrincipal()!);
      }
    
      return {
        content: [{
          type: "text" as const,
          text: JSON.stringify(result, bigIntReplacer, 2),
        }],
      };
    },
  • The inputSchema definition for "menese_swap" using Zod.
    inputSchema: {
      chain: z.enum(SUPPORTED_CHAINS as unknown as [string, ...string[]]).describe("Chain to swap on"),
      fromToken: z.string().describe("Source token symbol or address"),
      toToken: z.string().describe("Destination token symbol or address"),
      amount: z.string().describe("Amount of fromToken to swap (decimal)"),
      slippageBps: z.number().min(1).max(5000).optional()
        .describe("Slippage tolerance in basis points (default 250 = 2.5%)"),
      mode: z.enum(["quote", "execute"]).optional()
        .describe("'quote' to preview swap, 'execute' to swap. Default: execute"),
    },
Behavior3/5

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

With no annotations, the description carries the full burden. It adds valuable execution context via the DEX routing table (revealing which protocols handle which chains), but fails to disclose critical behavioral traits: that this is a destructive financial operation, irreversible on-chain, requires gas fees, or that slippage protection failures result in reverted transactions.

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?

Extremely dense single sentence with pipe-delimited protocol list. Every token earns its place—no filler, immediately front-loaded with action ('Swap tokens'), followed by mechanism ('via DEX'), then specific implementation details. Optimal information density.

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?

Adequate for tool identification given the rich schema, but incomplete for a high-stakes financial operation. Missing: destructive warnings, irreversibility notices, gas fee implications, and failure mode descriptions. The presence of menese_setup as a sibling suggests prerequisites that should be mentioned.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is satisfied. The description adds meaningful semantic context by mapping chain parameter values to specific DEX implementations (e.g., EVM chains use Uniswap V3), which helps agents understand execution routing beyond the raw schema enum values.

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?

Specific verb 'Swap' + resource 'tokens' + mechanism 'via DEX' with explicit chain-to-DEX mapping (Uniswap V3, Raydium, etc.). The mention of specific DEX implementations distinguishes this from sibling menese_send (likely simple transfers) and establishes the trading nature of the operation.

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?

Provides no guidance on when to use this tool versus siblings, particularly the ambiguous overlap with menese_quote (which likely fetches prices) while this tool also offers a 'quote' mode. No mention of prerequisites (e.g., menese_setup) or when to prefer quote vs execute modes.

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/Aboodtt404/mcp-menese-sdk'

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