Skip to main content
Glama

write.pool.redeem

Burns tranche shares to withdraw underlying asset and accrued interest from an Arcadia lending tranche. Builds an unsigned redeem transaction for the specified owner and receiver.

Instructions

Build an unsigned redeem transaction to withdraw from an Arcadia lending tranche (ERC-4626). Burns tranche shares and returns the corresponding amount of underlying asset, including accrued interest. The owner must be the shares holder; receiver is where the underlying asset is sent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tranche_addressYesTranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.
sharesYesAmount of tranche shares to burn, in raw units. To redeem everything, use the owner's full share balance.
receiverYesAddress that receives the underlying asset. Usually the owner's own wallet.
ownerYesAddress that owns the tranche shares being burned. Normally the signer's own wallet.
chain_idNoChain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes
transactionYes
predicted_account_addressNo

Implementation Reference

  • Handler function that registers the write.pool.redeem tool. Validates addresses, encodes the ERC-4626 redeem() call using tranche ABI, appends an ERC-8021 attribution suffix, and returns an unsigned transaction object (to, data, value, chainId).
    export function registerPoolRedeemTool(server: McpServer, _chains: Record<ChainId, ChainConfig>) {
      server.registerTool(
        "write.pool.redeem",
        {
          annotations: {
            title: "Build Pool Redeem Transaction",
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: false,
          },
          outputSchema: SimpleTransactionOutput,
          description:
            "Build an unsigned redeem transaction to withdraw from an Arcadia lending tranche (ERC-4626). Burns tranche shares and returns the corresponding amount of underlying asset, including accrued interest. The owner must be the shares holder; receiver is where the underlying asset is sent.",
          inputSchema: {
            tranche_address: z
              .string()
              .describe(
                "Tranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.",
              ),
            shares: z
              .string()
              .describe(
                "Amount of tranche shares to burn, in raw units. To redeem everything, use the owner's full share balance.",
              ),
            receiver: z
              .string()
              .describe("Address that receives the underlying asset. Usually the owner's own wallet."),
            owner: z
              .string()
              .describe(
                "Address that owns the tranche shares being burned. Normally the signer's own wallet.",
              ),
            chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
          },
        },
        async (params) => {
          try {
            const validTranche = validateAddress(params.tranche_address, "tranche_address");
            const validReceiver = validateAddress(params.receiver, "receiver");
            const validOwner = validateAddress(params.owner, "owner");
            const shares = BigInt(params.shares);
    
            let data = encodeFunctionData({
              abi: trancheAbi,
              functionName: "redeem",
              args: [shares, validReceiver, validOwner],
            });
            data = appendDataSuffix(data) as `0x${string}`;
    
            const result = {
              description: `Redeem ${params.shares} shares of tranche ${params.tranche_address}, sending the underlying asset to ${params.receiver}`,
              transaction: {
                to: validTranche,
                data,
                value: "0",
                chainId: params.chain_id,
              },
            };
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(result, null, 2),
                },
              ],
              structuredContent: result,
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    }
  • Input schema definition for write.pool.redeem: tranche_address, shares, receiver, owner (all strings), and chain_id (number, default 8453).
    inputSchema: {
      tranche_address: z
        .string()
        .describe(
          "Tranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.",
        ),
      shares: z
        .string()
        .describe(
          "Amount of tranche shares to burn, in raw units. To redeem everything, use the owner's full share balance.",
        ),
      receiver: z
        .string()
        .describe("Address that receives the underlying asset. Usually the owner's own wallet."),
      owner: z
        .string()
        .describe(
          "Address that owns the tranche shares being burned. Normally the signer's own wallet.",
        ),
      chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
    },
  • Output schema (SimpleTransactionOutput) used by write.pool.redeem: contains description string and transaction object (to, data, value, chainId).
    export const SimpleTransactionOutput = z.object({
      description: z.string(),
      transaction: Transaction,
      predicted_account_address: z.string().optional(),
    });
  • Registration call in registerAllTools() that wires up the write.pool.redeem tool under the 'Write tools — pool' section.
    registerPoolRedeemTool(server, chains);
  • Helper that appends an ERC-8021 attribution suffix to the encoded redeem calldata for on-chain attribution.
    export function appendDataSuffix(calldata: string): string {
      if (!DATA_SUFFIX) return calldata;
      return calldata + DATA_SUFFIX.slice(2);
    }
Behavior4/5

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

Annotations are neutral (no readOnly/destructive hints), so the description carries the burden. It discloses that the tool burns shares and returns underlying asset with accrued interest, and that the owner must be the shares holder. This adds meaningful behavioral context beyond the structured fields.

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?

Three sentences with no filler. The first sentence states purpose, the second explains the effect, the third provides ownership requirements. Every sentence is essential and front-loaded.

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

Completeness4/5

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

Given the tool builds an unsigned transaction and has an output schema, the description covers the primary purpose, key parameter relationships, and constraints (owner=holder, receiver destination). It does not detail the output format or signing steps, but the output schema likely fills that gap. Overall sufficiently complete for a transaction builder.

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 3. The description adds value by providing usage hints: referencing read.pool.list for tranche_address, advising to use full share balance for redemption, and clarifying that receiver is typically the owner's wallet. This goes beyond the schema descriptions.

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 builds an unsigned redeem transaction for Arcadia lending tranche (ERC-4626), with specific verb 'build', resource 'unsigned redeem transaction', and context 'withdraw from Arcadia lending tranche'. It distinguishes from sibling tools like write.pool.deposit by mentioning redemption specifically.

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 use: it explains the roles of owner and receiver, and gives a hint to get tranche_address from read.pool.list. However, it does not explicitly state when not to use this tool or compare with alternatives like write.account.withdraw, so it misses some exclusion guidance.

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