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
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Auto-invest action | |
| amount | No | USD amount per purchase (for 'setup') | |
| frequency | No | Purchase frequency (for 'setup') | |
| strategy | No | Strategy name (for 'setup') | |
| asset | No | Single asset (for 'setup', alternative to strategy) | |
| scheduleId | No | Schedule ID (for 'stop') |
Implementation Reference
- packages/mcp/src/tools/write.ts:422-453 (handler)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); } }, - packages/mcp/src/tools/write.ts:411-421 (registration)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')"), },