madeonsol_copytrade_get
Retrieve a specific copy-trade rule using its subscription ID to view details of a configured copy trading strategy.
Instructions
Get one copy-trade rule by id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Subscription id |
Implementation Reference
- src/index.ts:711-719 (registration)Registration of the 'madeonsol_copytrade_get' MCP tool via server.tool() with the name, description, schema, annotations, and handler.
server.tool( "madeonsol_copytrade_get", "Get one copy-trade rule by id.", { id: z.number().describe("Subscription id") }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, async ({ id }) => ({ content: [{ type: "text" as const, text: await restQuery("GET", `/copytrade/subscriptions/${id}`) }], }) ); - src/index.ts:714-715 (schema)Input schema for madeonsol_copytrade_get: a single 'id' parameter of type number, described as 'Subscription id'.
{ id: z.number().describe("Subscription id") }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, - src/index.ts:716-718 (handler)Handler function that makes a GET request to /copytrade/subscriptions/{id} via the restQuery helper to retrieve a copy-trade rule.
async ({ id }) => ({ content: [{ type: "text" as const, text: await restQuery("GET", `/copytrade/subscriptions/${id}`) }], }) - src/index.ts:451-466 (helper)The restQuery helper function used by the handler to make authenticated REST API calls to the MadeOnSol backend.
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); }