get_stats
Retrieve AgentFuse dashboard summary stats including total clicks, signups, commissions, and top-performing programs for reporting revenue data.
Instructions
Retrieve AgentFuse dashboard summary stats: total clicks, signups, commissions, and top-performing programs. Useful for reporting to users or surfacing revenue data.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:387-389 (handler)The handler function for the 'get_stats' tool. It calls agentfuse('GET', '/api/stats') to retrieve dashboard summary stats (total clicks, signups, commissions, top-performing programs).
async function handleGetStats() { return agentfuse("GET", "/api/stats"); } - src/index.js:169-179 (schema)The tool definition and input schema for 'get_stats'. No input parameters are required — the tool takes an empty object.
{ name: "get_stats", description: "Retrieve AgentFuse dashboard summary stats: total clicks, signups, commissions, " + "and top-performing programs. Useful for reporting to users or surfacing revenue data.", inputSchema: { type: "object", properties: {}, required: [], }, }, - src/index.js:446-454 (registration)The HANDLERS dispatch map that maps the tool name 'get_stats' to its handler function 'handleGetStats'.
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, }; - src/index.js:32-78 (helper)The 'agentfuse' helper function used by handleGetStats to make HTTP requests to the AgentFuse REST API.
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; }