Skip to main content
Glama

t2000_withdraw

Transfer funds from savings to checking accounts. Specify dollar amount or use "all" for full balance, with optional preview mode before executing.

Instructions

Withdraw from savings back to checking. Amount is in dollars. Use "all" to withdraw everything. Set dryRun: true to preview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesDollar amount to withdraw, or "all"
dryRunNoPreview without signing (default: false)

Implementation Reference

  • The implementation of the 't2000_withdraw' tool, which handles withdrawals from savings, including a dry-run preview mode and mutex-locked execution.
    server.tool(
      't2000_withdraw',
      'Withdraw from savings back to checking. Amount is in dollars. Use "all" to withdraw everything. Set dryRun: true to preview.',
      {
        amount: z.union([z.number(), z.literal('all')]).describe('Dollar amount to withdraw, or "all"'),
        dryRun: z.boolean().optional().describe('Preview without signing (default: false)'),
      },
      async ({ amount, dryRun }) => {
        try {
          if (dryRun) {
            agent.enforcer.assertNotLocked();
            const positions = await agent.positions();
            const health = await agent.healthFactor();
            const savings = positions.positions
              .filter(p => p.type === 'save')
              .reduce((sum, p) => sum + p.amount, 0);
    
            return {
              content: [{
                type: 'text',
                text: JSON.stringify({
                  preview: true,
                  amount: amount === 'all' ? savings : amount,
                  currentSavings: savings,
                  currentHealthFactor: health.healthFactor,
                }),
              }],
            };
          }
    
          const result = await mutex.run(() => agent.withdraw({ amount }));
          return { content: [{ type: 'text', text: JSON.stringify(result) }] };
        } catch (err) {
          return errorResult(err);
        }
      },
    );

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/mission69b/t2000'

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