Skip to main content
Glama

clicks_withdraw_yield

Withdraw earned yield and principal from an AI agent's DeFi position on Base. Authorized users can specify amounts or withdraw all available funds in USDC.

Instructions

Withdraw yield + principal for an agent. Only the agent, their operator, or contract owner can withdraw.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_addressYesEthereum address of the AI agent
amountNoAmount to withdraw in USDC. Omit to withdraw everything.

Implementation Reference

  • The handler implementation for the `clicks_withdraw_yield` tool in the MCP server, which interacts with a contract to withdraw funds.
      async ({ agent_address, amount }) => {
        const signer = getSigner();
        const splitter = new Contract(ADDRESSES.splitter, SPLITTER_ABI, signer);
        const amountWei = amount ? parseUnits(amount, 6) : 0n;
        const tx = await splitter.withdrawYield(agent_address, amountWei);
        await tx.wait();
    
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              success: true,
              txHash: tx.hash,
              agent: agent_address,
              amount_usdc: amount || 'all',
              message: `Withdrawal complete. USDC returned to agent wallet (2% fee on yield only).`,
            }, null, 2),
          }],
        };
      },
    );
  • The registration of the `clicks_withdraw_yield` tool in the MCP server, including the input schema.
    server.tool(
      'clicks_withdraw_yield',
      'Withdraw yield + principal for an agent. Only the agent, their operator, or contract owner can withdraw.',
      {
        agent_address: z.string().describe('Ethereum address of the AI agent'),
        amount: z.string().optional().describe('Amount to withdraw in USDC. Omit to withdraw everything.'),
      },
Behavior3/5

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

No annotations provided, so description carries full burden. Adds crucial authorization context but omits other behavioral traits expected for blockchain operations: irreversibility, gas/transaction fees, state changes to balances, or return value (transaction hash vs boolean).

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 sentences with zero waste. Front-loaded with action ('Withdraw'), followed by scope ('yield + principal'), target ('for an agent'), and authorization constraint. Every clause earns its place.

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

Completeness3/5

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

Adequate for a 2-parameter withdrawal operation with good schema coverage. However, given this is a financial blockchain transaction with no output schema or annotations, the description should ideally disclose the return type (e.g., transaction hash) or confirm this initiates an on-chain transaction.

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%, providing complete parameter documentation (agent_address, amount with USDC unit and optional semantics). Description text adds no additional parameter details beyond what the schema provides, warranting 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?

Specific verb ('Withdraw') + specific resources ('yield + principal') + specific target ('for an agent'). Clearly distinguishes from siblings like clicks_get_yield_info (read-only) and clicks_set_yield_pct (configuration).

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?

Provides explicit authorization constraint ('Only the agent, their operator, or contract owner can withdraw'), which is critical prerequisite guidance for this financial operation. Lacks explicit comparison to sibling withdrawal alternatives (if any exist).

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/clicks-protocol/clicks-protocol'

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