write.asset_manager.cow_swapper
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
| Name | Required | Description | Default |
|---|---|---|---|
| enabled | No | True to enable, false to disable | |
| chain_id | No | Chain ID: 8453 (Base) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| datas | Yes | ||
| statuses | Yes | ||
| description | No | ||
| strategy_name | No | ||
| asset_managers | Yes |
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, }; } }, - src/tools/write/asset-managers/cow-swapper.ts:10-57 (registration)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, }; } }, );