Skip to main content
Glama

write.asset_manager.cow_swapper

Read-onlyIdempotent

Swap ERC20 tokens via CoW Protocol batch auctions with MEV protection on Base network. Generates data for asset manager configuration requiring account owner signatures for each transaction.

Instructions

Encode args for standalone direct CowSwap mode. Enables the CowSwapper to swap any ERC20 → ERC20 via CoW Protocol batch auctions (MEV-protected). Unlike compounder_staked or yield_claimer_cowswap, this is NOT coupled to any other automation — each swap requires an additional signature from the account owner. Only available on Base (8453). Returns { asset_managers, statuses, datas } — pass to write.account.set_asset_managers. Combinable with other intent tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enabledNoTrue to enable, false to disable
chain_idNoChain ID: 8453 (Base)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
datasYes
statusesYes
descriptionNo
strategy_nameNo
asset_managersYes

Implementation Reference

  • The handler function that executes the cow_swapper tool logic.
    async (params) => {
      try {
        const validChainId = validateChainId(params.chain_id);
        const cowSwapperAddress = getStandaloneAmAddress(validChainId, "cowSwapper");
    
        if (!params.enabled)
          return formatResult(disabledIntent([cowSwapperAddress], "Disable cow_swapper"));
    
        const cowSwapperData = encodeOuterMetadata("cow_swap_direct", "0x");
        const result = {
          description: "Enable cow_swapper (direct mode)",
          asset_managers: [cowSwapperAddress],
          statuses: [true],
          datas: [cowSwapperData],
        };
        return formatResult(result);
      } catch (err) {
        return {
          content: [
            {
              type: "text" as const,
              text: `Error: ${err instanceof Error ? err.message : String(err)}`,
            },
          ],
          isError: true,
        };
      }
    },
  • The registration function that defines the tool and its schema.
    export function registerCowSwapperTool(server: McpServer, _chains: Record<ChainId, ChainConfig>) {
      server.registerTool(
        "write.asset_manager.cow_swapper",
        {
          annotations: {
            title: "Encode Direct CowSwap Automation",
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
          },
          description:
            "Encode args for standalone direct CowSwap mode. Enables the CowSwapper to swap any ERC20 → ERC20 via CoW Protocol batch auctions (MEV-protected). Unlike compounder_staked or yield_claimer_cowswap, this is NOT coupled to any other automation — each swap requires an additional signature from the account owner. Only available on Base (8453). Returns { asset_managers, statuses, datas } — pass to write.account.set_asset_managers. Combinable with other intent tools.",
          outputSchema: IntentOutput,
          inputSchema: {
            enabled: z.boolean().default(true).describe("True to enable, false to disable"),
            chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base)"),
          },
        },
        async (params) => {
          try {
            const validChainId = validateChainId(params.chain_id);
            const cowSwapperAddress = getStandaloneAmAddress(validChainId, "cowSwapper");
    
            if (!params.enabled)
              return formatResult(disabledIntent([cowSwapperAddress], "Disable cow_swapper"));
    
            const cowSwapperData = encodeOuterMetadata("cow_swap_direct", "0x");
            const result = {
              description: "Enable cow_swapper (direct mode)",
              asset_managers: [cowSwapperAddress],
              statuses: [true],
              datas: [cowSwapperData],
            };
            return formatResult(result);
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );

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/arcadia-finance/arcadia-finance-mcp-server'

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