Skip to main content
Glama

write.pool.deposit

Deposit underlying assets into an Arcadia lending tranche and receive tranche shares that accrue interest from borrowers. Builds an unsigned transaction; requires prior ERC-20 approval.

Instructions

Build an unsigned deposit transaction into an Arcadia lending tranche (ERC-4626). Lenders deposit the pool's underlying asset (USDC/WETH/cbBTC) and receive tranche shares that accrue interest from borrowers. Requires prior ERC-20 approval to the tranche (see write.wallet.approve). To check current lender yield, call read.pool.list or read.pool.info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tranche_addressYesTranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.
assetsYesAmount of underlying asset to deposit, in raw units (e.g. '1000000' = 1 USDC since USDC has 6 decimals).
receiverYesAddress that receives the minted tranche shares. Usually the depositor'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

  • The tool handler for 'write.pool.deposit'. Registers the tool with the MCP server, defines input schema (tranche_address, assets, receiver, chain_id), validates addresses, encodes the deposit() function call to the tranche ABI (ERC-4626), appends data suffix (ERC-8021), and returns the unsigned transaction.
    import { z } from "zod";
    import { encodeFunctionData } from "viem";
    import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { CHAIN_ID_DESCRIPTION, type ChainId, type ChainConfig } from "../../../config/chains.js";
    import { trancheAbi } from "../../../abis/index.js";
    import { appendDataSuffix } from "../../../utils/attribution.js";
    import { validateAddress } from "../../../utils/validation.js";
    import { SimpleTransactionOutput } from "../../output-schemas.js";
    
    export function registerPoolDepositTool(server: McpServer, _chains: Record<ChainId, ChainConfig>) {
      server.registerTool(
        "write.pool.deposit",
        {
          annotations: {
            title: "Build Pool Deposit Transaction",
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: false,
          },
          outputSchema: SimpleTransactionOutput,
          description:
            "Build an unsigned deposit transaction into an Arcadia lending tranche (ERC-4626). Lenders deposit the pool's underlying asset (USDC/WETH/cbBTC) and receive tranche shares that accrue interest from borrowers. Requires prior ERC-20 approval to the tranche (see write.wallet.approve). To check current lender yield, call read.pool.list or read.pool.info.",
          inputSchema: {
            tranche_address: z
              .string()
              .describe(
                "Tranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.",
              ),
            assets: z
              .string()
              .describe(
                "Amount of underlying asset to deposit, in raw units (e.g. '1000000' = 1 USDC since USDC has 6 decimals).",
              ),
            receiver: z
              .string()
              .describe(
                "Address that receives the minted tranche shares. Usually the depositor'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 assets = BigInt(params.assets);
    
            let data = encodeFunctionData({
              abi: trancheAbi,
              functionName: "deposit",
              args: [assets, validReceiver],
            });
            data = appendDataSuffix(data) as `0x${string}`;
    
            const result = {
              description: `Deposit ${params.assets} of the tranche's underlying asset into ${params.tranche_address}, minting shares 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 and annotations for the tool. Defines 'tranche_address' (string), 'assets' (string, raw units), 'receiver' (address), and 'chain_id' (number, default 8453). Output schema is SimpleTransactionOutput imported from output-schemas.ts.
        openWorldHint: false,
      },
      outputSchema: SimpleTransactionOutput,
      description:
        "Build an unsigned deposit transaction into an Arcadia lending tranche (ERC-4626). Lenders deposit the pool's underlying asset (USDC/WETH/cbBTC) and receive tranche shares that accrue interest from borrowers. Requires prior ERC-20 approval to the tranche (see write.wallet.approve). To check current lender yield, call read.pool.list or read.pool.info.",
      inputSchema: {
        tranche_address: z
          .string()
          .describe(
            "Tranche contract address (ERC-4626 vault). Get this from read.pool.list — each pool's `tranches[0].address`.",
          ),
        assets: z
          .string()
          .describe(
            "Amount of underlying asset to deposit, in raw units (e.g. '1000000' = 1 USDC since USDC has 6 decimals).",
          ),
        receiver: z
          .string()
          .describe(
            "Address that receives the minted tranche shares. Usually the depositor's own wallet.",
          ),
        chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
      },
    },
  • Import of registerPoolDepositTool from the deposit module.
    import { registerPoolDepositTool } from "./write/pool/deposit.js";
  • Registration call: registerPoolDepositTool(server, chains) invoked during setup.
    registerPoolDepositTool(server, chains);
  • SimpleTransactionOutput Zod schema used as the output schema for write.pool.deposit. Contains description (string), transaction (object with to, data, value, chainId), and optional predicted_account_address.
    export const SimpleTransactionOutput = z.object({
      description: z.string(),
      transaction: Transaction,
      predicted_account_address: z.string().optional(),
    });
Behavior5/5

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

The description explicitly states the tool builds an *unsigned* transaction rather than executing it, which is a critical behavioral detail not captured by annotations. It also mentions the prerequisite approval, adding transparency 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?

Two succinct sentences with no wasted words. The key information is front-loaded: purpose in the first sentence, prerequisites and related tools immediately follow.

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 complexity of a DeFi deposit transaction and the presence of an output schema, the description adequately covers what the tool does, prerequisites, and related tools. It could mention the output transaction object, but the output schema likely compensates.

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% with good descriptions. The description adds extra value: an example for 'assets' (e.g., '1000000' = 1 USDC) and typical usage for 'receiver' (the depositor's wallet). This goes beyond the schema.

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 deposit transaction into an Arcadia lending tranche (ERC-4626), specifying the action and target. It distinguishes from siblings like write.pool.redeem by focusing on deposit.

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 prerequisites (prior ERC-20 approval) and references write.wallet.approve for that step. It also suggests checking current yield via read.pool.list or read.pool.info. It does not explicitly exclude alternatives but offers clear usage context.

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