Skip to main content
Glama

write.asset_manager.compounder

Read-onlyIdempotent

Claim accumulated LP trading fees and reinvest them to compound interest. Automates compounding between rebalances when paired with a rebalancer.

Instructions

Encode args for the standalone compounder automation. Claims accumulated LP trading fees and reinvests them back into the position (compound interest). LP fees only — does NOT claim staking rewards like AERO; use write.asset_manager.compounder_staked for staked positions earning emission tokens. When paired with a rebalancer, the rebalancer compounds at rebalance time — adding a compounder also compounds between rebalances for higher effective APY. Returns { asset_managers, statuses, datas } — pass to write.account.set_asset_managers. Combinable with other intent tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dex_protocolYesDEX protocol of the LP position — used to resolve the correct asset manager address.
enabledNoTrue to enable, false to disable
chain_idNoChain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNo
asset_managersYes
statusesYes
datasYes
strategy_nameNo

Implementation Reference

  • Handler function for write.asset_manager.compounder — validates inputs, resolves the compounder address for the given DEX protocol & chain, and encodes the callback data (or disabled intent). Registered via MCP server.registerTool with name 'write.asset_manager.compounder'.
    server.registerTool(
      "write.asset_manager.compounder",
      {
        annotations: {
          title: "Encode Compounder Automation",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
        },
        description:
          "Encode args for the standalone compounder automation. Claims accumulated LP trading fees and reinvests them back into the position (compound interest). LP fees only — does NOT claim staking rewards like AERO; use write.asset_manager.compounder_staked for staked positions earning emission tokens. When paired with a rebalancer, the rebalancer compounds at rebalance time — adding a compounder also compounds between rebalances for higher effective APY. Returns { asset_managers, statuses, datas } — pass to write.account.set_asset_managers. Combinable with other intent tools.",
        outputSchema: IntentOutput,
        inputSchema: {
          dex_protocol: DEX_PROTOCOL_SCHEMA,
          enabled: z.boolean().default(true).describe("True to enable, false to disable"),
          chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
        },
      },
      async (params) => {
        try {
          const validChainId = validateChainId(params.chain_id);
          const amKey = dexProtocolToAmKey(params.dex_protocol);
          const amAddress = getAmProtocolAddress(validChainId, "compounders", amKey);
    
          if (!params.enabled)
            return formatResult(
              disabledIntent([amAddress], `Disable compounder (${params.dex_protocol})`),
            );
    
          const callbackData = encodeCompounderCallbackData(COMPOUNDER_INITIATOR);
          const result = {
            description: `Enable compounder (${params.dex_protocol})`,
            asset_managers: [amAddress],
            statuses: [true],
            datas: [callbackData],
          };
          return formatResult(result);
        } catch (err) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: ${err instanceof Error ? err.message : String(err)}`,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • Input schema for the compounder tool: dex_protocol (enum of DEX protocols), enabled (boolean, default true), chain_id (number, default 8453).
    inputSchema: {
      dex_protocol: DEX_PROTOCOL_SCHEMA,
      enabled: z.boolean().default(true).describe("True to enable, false to disable"),
      chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
    },
  • Registration entry point — registerCompounderTools is called from src/tools/index.ts to add the compounder tools to the MCP server.
    registerCompounderTools(server, chains);
  • Helper function that encodes the ABI-encoded callback data for the compounder, including the initiator address, fee/tolerance parameters, and empty metadata.
    export function encodeCompounderCallbackData(initiator: `0x${string}`): `0x${string}` {
      return encodeAbiParameters(
        [
          { name: "initiator", type: "address" },
          { name: "maxClaimFee", type: "uint256" },
          { name: "maxSwapFee", type: "uint256" },
          { name: "maxTolerance", type: "uint256" },
          { name: "minLiquidityRatio", type: "uint256" },
          { name: "metaData_", type: "bytes" },
        ],
        [
          initiator,
          DEFAULT_MAX_CLAIM_FEE,
          DEFAULT_MAX_SWAP_FEE,
          DEFAULT_MAX_TOLERANCE,
          DEFAULT_MIN_LIQUIDITY_RATIO,
          "0x",
        ],
      );
    }
  • Output schema (IntentOutput) used by the compounder tool — returns asset_managers, statuses, datas arrays intended for passing to write.account.set_asset_managers.
    export const IntentOutput = z.object({
      description: z.string().optional(),
      asset_managers: z.array(z.string()),
      statuses: z.array(z.boolean()),
      datas: z.array(z.string()),
      strategy_name: z.string().optional(),
    });
Behavior1/5

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

Description claims the tool 'Claims accumulated LP trading fees', implying a mutation, but annotations include readOnlyHint: true. This is a direct contradiction, undermining transparency.

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

Conciseness4/5

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

The description is concise and front-loaded with key information, but includes optional detail about rebalancer pairing that could be slightly trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, usage alternatives, return format, and combinability with other tools. Output schema exists and return value is explicitly described.

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 coverage is 100% with descriptions for all 3 parameters. Description adds no parameter-specific info beyond what schema already provides, earning the baseline score.

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 it encodes args for the compounder automation, claims LP fees, and reinvests them. It differentiates from the staked variant by excluding staking rewards.

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

Usage Guidelines5/5

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

Explicitly specifies when to use this tool vs the staked compounder, and explains interaction with rebalancer for compounding between rebalances.

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

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