madeonsol_copytrade_update
Toggle active state and update parameters like wallets, trade size, action type, and delivery mode for a copy-trade rule.
Instructions
Update fields on a copy-trade rule, including is_active toggle.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Subscription id | |
| name | No | ||
| source_wallets | No | ||
| min_trade_sol | No | ||
| only_action | No | ||
| sizing_mode | No | ||
| sizing_amount | No | ||
| delivery_mode | No | ||
| webhook_url | No | ||
| is_active | No |
Implementation Reference
- src/index.ts:737-744 (handler)The handler/executor for the madeonsol_copytrade_update tool. It destructures 'id' from args, collects the remaining patch fields into a body object, and sends a PATCH request to /api/v1/copytrade/subscriptions/{id}.
async ({ id, ...patch }) => { const body: Record<string, unknown> = {}; for (const [k, v] of Object.entries(patch)) { if (v !== undefined) body[k] = v; } return { content: [{ type: "text" as const, text: await restQuery("PATCH", `/copytrade/subscriptions/${id}`, body) }] }; } ); - src/index.ts:724-735 (schema)Input schema for madeonsol_copytrade_update using Zod. Defines the parameters: id (number, required), and optional fields name, source_wallets, min_trade_sol, only_action, sizing_mode, sizing_amount, delivery_mode, webhook_url, and is_active.
{ id: z.number().describe("Subscription id"), name: z.string().nullable().optional(), source_wallets: z.array(z.string()).optional(), min_trade_sol: z.number().optional(), only_action: z.enum(["buy", "sell", "both"]).optional(), sizing_mode: z.enum(["fixed", "proportional", "percent_source"]).optional(), sizing_amount: z.number().optional(), delivery_mode: z.enum(["webhook", "websocket", "both"]).optional(), webhook_url: z.string().url().nullable().optional(), is_active: z.boolean().optional(), }, - src/index.ts:721-744 (registration)Registration of the tool via server.tool() call with the name 'madeonsol_copytrade_update', description, schema object, annotations, and handler function.
server.tool( "madeonsol_copytrade_update", "Update fields on a copy-trade rule, including is_active toggle.", { id: z.number().describe("Subscription id"), name: z.string().nullable().optional(), source_wallets: z.array(z.string()).optional(), min_trade_sol: z.number().optional(), only_action: z.enum(["buy", "sell", "both"]).optional(), sizing_mode: z.enum(["fixed", "proportional", "percent_source"]).optional(), sizing_amount: z.number().optional(), delivery_mode: z.enum(["webhook", "websocket", "both"]).optional(), webhook_url: z.string().url().nullable().optional(), is_active: z.boolean().optional(), }, { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }, async ({ id, ...patch }) => { const body: Record<string, unknown> = {}; for (const [k, v] of Object.entries(patch)) { if (v !== undefined) body[k] = v; } return { content: [{ type: "text" as const, text: await restQuery("PATCH", `/copytrade/subscriptions/${id}`, body) }] }; } ); - src/index.ts:451-466 (helper)The restQuery helper function used by the handler to make authenticated REST API calls. It constructs the URL, applies headers (including Bearer auth), sends the request with method and body, and returns the JSON response or an error string.
async function restQuery(method: string, path: string, body?: unknown): Promise<string> { const headers: Record<string, string> = { "Content-Type": "application/json", ...apiKeyHeaders(), }; const res = await fetch(`${BASE_URL}/api/v1${path}`, { method, headers, ...(body ? { body: JSON.stringify(body) } : {}), }); if (!res.ok) { const text = await res.text().catch(() => ""); return `Error ${res.status}: ${text}`; } return JSON.stringify(await res.json(), null, 2); }