list_tracked_links
Retrieve previously generated affiliate links with their tracking details, click counts, and program info to review existing links before creating new ones or display active referral links for a user.
Instructions
List tracked affiliate links previously generated by this API key. Returns each link's tracked URL, tracking_code, click count, program, and end user. Use this to look up existing links before generating a new one, or to show a user their active referral links.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_user_id | No | Filter links by end user ID. Use this to fetch all links for a specific user. | |
| program_slug | No | Filter links by program slug (e.g. 'webflow'). The tool resolves the slug to a UUID automatically before querying. | |
| limit | No | Number of links to return (default: 20, max: 100). | |
| cursor | No | Pagination cursor from a previous call to get the next page. |
Implementation Reference
- src/index.js:364-385 (handler)Handler function for list_tracked_links tool. Builds query params from args (end_user_id, limit, cursor) and optionally resolves program_slug to a UUID via the catalog API before making a GET request to /api/links.
async function handleListTrackedLinks(args) { const params = new URLSearchParams(); if (args.end_user_id) params.set("end_user_id", args.end_user_id); if (args.limit) params.set("limit", String(args.limit)); if (args.cursor) params.set("cursor", args.cursor); // Optional: resolve program_slug -> program_id UUID for filtering if (args.program_slug) { const catalogData = await agentfuse("GET", `/api/catalog/${encodeURIComponent(args.program_slug)}`); const program_id = catalogData?.data?.id; if (!program_id) { throw new McpError( ErrorCode.InvalidParams, `Program not found for slug "${args.program_slug}". Use list_affiliate_programs to check available slugs.` ); } params.set("program_id", program_id); } const qs = params.toString(); return agentfuse("GET", `/api/links${qs ? "?" + qs : ""}`); } - src/index.js:180-213 (schema)Schema/definition for list_tracked_links tool. All properties (end_user_id, program_slug, limit, cursor) are optional.
{ name: "list_tracked_links", description: "List tracked affiliate links previously generated by this API key. " + "Returns each link's tracked URL, tracking_code, click count, program, and end user. " + "Use this to look up existing links before generating a new one, or to show a user " + "their active referral links.", inputSchema: { type: "object", properties: { end_user_id: { type: "string", description: "Filter links by end user ID. Use this to fetch all links for a specific user.", }, program_slug: { type: "string", description: "Filter links by program slug (e.g. 'webflow'). " + "The tool resolves the slug to a UUID automatically before querying.", }, limit: { type: "number", description: "Number of links to return (default: 20, max: 100).", minimum: 1, maximum: 100, }, cursor: { type: "string", description: "Pagination cursor from a previous call to get the next page.", }, }, required: [], }, - src/index.js:446-454 (registration)Registration in the HANDLERS dispatch map that maps tool name 'list_tracked_links' to its handler function.
export const HANDLERS = { list_affiliate_programs: handleListAffiliatePrograms, get_affiliate_program: handleGetAffiliateProgram, generate_tracked_link: handleGenerateTrackedLink, list_tracked_links: handleListTrackedLinks, get_stats: handleGetStats, record_signup: handleRecordSignup, record_commission: handleRecordCommission, };