get_affiliate_program
Retrieve complete details of an affiliate program using its slug. Obtain UUID, commission structure, payout terms, description, and network information.
Instructions
Get full details for a single affiliate program by its slug. Returns the program's UUID (needed for generate_tracked_link), commission structure, payout terms, description, and network info.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The program slug (e.g. 'webflow', 'elevenlabs', 'notion', 'zapier'). Use list_affiliate_programs to discover available slugs. |
Implementation Reference
- src/index.js:329-334 (handler)Handler function for get_affiliate_program. Validates slug parameter is present, then calls agentfuse helper to GET /api/catalog/{slug}. Returns full program details including UUID, commission structure, payout terms, description, and network info.
async function handleGetAffiliateProgram(args) { if (!args.slug) { throw new McpError(ErrorCode.InvalidParams, "slug is required"); } return agentfuse("GET", `/api/catalog/${encodeURIComponent(args.slug)}`); } - src/index.js:116-134 (schema)Schema definition for get_affiliate_program tool. Defines input as an object with a required 'slug' string property. Description explains it returns program UUID, commission structure, payout terms, description, and network info.
{ name: "get_affiliate_program", description: "Get full details for a single affiliate program by its slug. " + "Returns the program's UUID (needed for generate_tracked_link), commission structure, " + "payout terms, description, and network info.", inputSchema: { type: "object", properties: { slug: { type: "string", description: "The program slug (e.g. 'webflow', 'elevenlabs', 'notion', 'zapier'). " + "Use list_affiliate_programs to discover available slugs.", }, }, required: ["slug"], }, }, - src/index.js:448-448 (registration)Registration/dispatch map entry mapping the tool name 'get_affiliate_program' to its handler function handleGetAffiliateProgram.
get_affiliate_program: handleGetAffiliateProgram, - src/index.js:32-78 (helper)Helper function 'agentfuse' used by the handler to make REST API calls to AgentFuse. Handles auth, request formatting, error parsing, and JSON responses.
export async function agentfuse(method, path, body = null) { const apiKey = process.env.AGENTFUSE_API_KEY || ""; const baseUrl = (process.env.AGENTFUSE_API_URL || "https://api.agentfuse.io").replace(/\/$/, ""); if (!apiKey) { throw new McpError( ErrorCode.InvalidRequest, "AGENTFUSE_API_KEY environment variable is not set. " + "Get a key at https://agentfuse.io and add it to your MCP config." ); } const url = `${baseUrl}${path}`; const headers = { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", "User-Agent": "agentfuse-mcp/1.1.2", }; const options = { method, headers }; if (body !== null) { options.body = JSON.stringify(body); } const res = await fetch(url, options); const text = await res.text(); let data; try { data = JSON.parse(text); } catch { throw new McpError( ErrorCode.InternalError, `AgentFuse API returned non-JSON response (status ${res.status}): ${text.slice(0, 200)}` ); } if (!res.ok) { const msg = data?.error || data?.message || JSON.stringify(data); throw new McpError( ErrorCode.InternalError, `AgentFuse API error ${res.status}: ${msg}` ); } return data; }