Skip to main content
Glama

t2000_auto_invest

Automate dollar-cost averaging investments by setting up recurring purchases into strategies or individual assets. Manage schedules with setup, status, run, and stop actions.

Instructions

Dollar-cost averaging (DCA) — set up recurring purchases into strategies or individual assets. Actions: setup, status, run, stop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAuto-invest action
amountNoUSD amount per purchase (for 'setup')
frequencyNoPurchase frequency (for 'setup')
strategyNoStrategy name (for 'setup')
assetNoSingle asset (for 'setup', alternative to strategy)
scheduleIdNoSchedule ID (for 'stop')

Implementation Reference

  • The handler implementation for the t2000_auto_invest tool, containing logic for setup, status, run, and stop actions.
    async ({ action, amount, frequency, strategy, asset, scheduleId }) => {
      try {
        switch (action) {
          case 'setup': {
            if (!amount || !frequency) {
              return { content: [{ type: 'text', text: JSON.stringify({ error: 'Amount and frequency required for setup' }) }] };
            }
            const schedule = agent.setupAutoInvest({ amount, frequency, strategy, asset });
            return { content: [{ type: 'text', text: JSON.stringify(schedule) }] };
          }
          case 'status': {
            const status = agent.getAutoInvestStatus();
            return { content: [{ type: 'text', text: JSON.stringify(status) }] };
          }
          case 'run': {
            const result = await mutex.run(() => agent.runAutoInvest());
            return { content: [{ type: 'text', text: JSON.stringify(result) }] };
          }
          case 'stop': {
            if (!scheduleId) {
              return { content: [{ type: 'text', text: JSON.stringify({ error: 'Schedule ID required for stop' }) }] };
            }
            agent.stopAutoInvest(scheduleId);
            return { content: [{ type: 'text', text: JSON.stringify({ stopped: scheduleId }) }] };
          }
          default:
            return { content: [{ type: 'text', text: JSON.stringify({ error: `Unknown action: ${action}` }) }] };
        }
      } catch (err) {
        return errorResult(err);
      }
    },
  • Registration and schema definition for the t2000_auto_invest tool.
    server.tool(
      't2000_auto_invest',
      'Dollar-cost averaging (DCA) — set up recurring purchases into strategies or individual assets. Actions: setup, status, run, stop.',
      {
        action: z.enum(['setup', 'status', 'run', 'stop']).describe("Auto-invest action"),
        amount: z.number().optional().describe("USD amount per purchase (for 'setup')"),
        frequency: z.enum(['daily', 'weekly', 'monthly']).optional().describe("Purchase frequency (for 'setup')"),
        strategy: z.string().optional().describe("Strategy name (for 'setup')"),
        asset: z.string().optional().describe("Single asset (for 'setup', alternative to strategy)"),
        scheduleId: z.string().optional().describe("Schedule ID (for 'stop')"),
      },

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