toggle_agent
Pause or resume an agent's automatic strategy execution in the conviction-mcp server. When paused, the agent stops entering pools via cron while manual entries remain functional.
Instructions
Pause or resume an agent's automatic strategy execution. When paused, the agent stops entering pools via cron. Manual entries via enter_position still work.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | The agent's profile ID. Auto-filled from saved credentials if omitted. | |
| owner_id | No | The owner's profile ID. Auto-filled from saved credentials if omitted. |
Implementation Reference
- mcp/src/index.ts:1098-1137 (handler)The handler for the `toggle_agent` MCP tool, which pauses or resumes an agent's automatic strategy execution by calling the `update-agent` API with the `toggle` action.
// ── Tool: toggle_agent ── server.tool( "toggle_agent", "Pause or resume an agent's automatic strategy execution. When paused, the agent stops entering pools via cron. Manual entries via enter_position still work.", { agent_id: z.string().optional().describe("The agent's profile ID. Auto-filled from saved credentials if omitted."), owner_id: z.string().optional().describe("The owner's profile ID. Auto-filled from saved credentials if omitted."), }, async ({ agent_id, owner_id }) => { const saved = loadSavedAgents(); const resolvedAgent = agent_id || (saved.length > 0 ? saved[saved.length - 1].agentId : null); const resolvedOwner = owner_id || (saved.length > 0 ? saved[saved.length - 1].ownerId : null); if (!resolvedAgent || !resolvedOwner) { return { content: [{ type: "text", text: "No agent found. Create one first with `create_agent`, or pass agent_id and owner_id." }], isError: true }; } const result = (await apiPost("update-agent", { action: "toggle", agentId: resolvedAgent, ownerProfileId: resolvedOwner, })) as any; if (!result.success) { return { content: [{ type: "text", text: `Toggle failed: ${result.error || "Unknown error"}` }], isError: true, }; } return { content: [ { type: "text", text: `Agent **${agent_id}** is now **${result.active ? "ACTIVE" : "PAUSED"}**. ${result.message || ""}`, }, ], }; } );