Skip to main content
Glama

t2000_borrow

Borrow USDC using savings as collateral. Check health factor to avoid liquidation risks. Preview transactions before signing.

Instructions

Borrow USDC against savings collateral. Check health factor first — below 1.0 risks liquidation. Amount is in dollars. Set dryRun: true to preview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesDollar amount to borrow
dryRunNoPreview without signing (default: false)

Implementation Reference

  • Implementation of the 't2000_borrow' tool handler.
    server.tool(
      't2000_borrow',
      'Borrow USDC against savings collateral. Check health factor first — below 1.0 risks liquidation. Amount is in dollars. Set dryRun: true to preview.',
      {
        amount: z.number().describe('Dollar amount to borrow'),
        dryRun: z.boolean().optional().describe('Preview without signing (default: false)'),
      },
      async ({ amount, dryRun }) => {
        try {
          if (dryRun) {
            agent.enforcer.assertNotLocked();
            const health = await agent.healthFactor();
            const maxBorrow = await agent.maxBorrow();
    
            return {
              content: [{
                type: 'text',
                text: JSON.stringify({
                  preview: true,
                  amount,
                  maxBorrow: maxBorrow.maxAmount,
                  currentHealthFactor: health.healthFactor,
                  estimatedHealthFactorAfter: maxBorrow.healthFactorAfter,
                }),
              }],
            };
          }
    
          const result = await mutex.run(() => agent.borrow({ 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