Skip to main content
Glama
sai4447

agentfuse-mcp

by sai4447

record_signup

Record affiliate signup conversion events using tracking codes from generate_tracked_link. Supports multiple networks and ensures idempotent logging with unique event IDs.

Instructions

Record an affiliate signup conversion event. Call this when one of your end users successfully signs up for a referred product. Requires the tracking_code returned by generate_tracked_link. Idempotent -- safe to call multiple times with the same network + network_event_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tracking_codeYesThe tracking code from the affiliate link (returned by generate_tracked_link). This ties the signup back to the original referral.
networkYesThe affiliate network that reported this event. One of: 'partnerstack', 'impact', 'direct'.
network_event_idYesUnique event ID from the affiliate network (or any unique string for 'direct'). Used for idempotency -- duplicate calls with the same ID are ignored.
signup_emailNoEmail address the user signed up with (optional but recommended).
metadataNoOptional extra data to attach to this event.

Implementation Reference

  • The handler function that executes the record_signup tool logic. Validates required args (tracking_code, network, network_event_id), builds a body with optional signup_email and metadata, then POSTs to /api/webhooks/signup via the agentfuse helper.
    async function handleRecordSignup(args) {
      if (!args.tracking_code) {
        throw new McpError(ErrorCode.InvalidParams, "tracking_code is required");
      }
      if (!args.network) {
        throw new McpError(ErrorCode.InvalidParams, "network is required (partnerstack, impact, or direct)");
      }
      if (!args.network_event_id) {
        throw new McpError(ErrorCode.InvalidParams, "network_event_id is required");
      }
    
      const body = {
        tracking_code: args.tracking_code,
        network: args.network,
        network_event_id: args.network_event_id,
      };
      if (args.signup_email) body.signup_email = args.signup_email;
      if (args.metadata)     body.metadata     = args.metadata;
    
      return agentfuse("POST", "/api/webhooks/signup", body);
    }
  • Tool definition and input schema for record_signup. Defines name, description, and inputSchema with properties: tracking_code (string, required), network (enum: partnerstack/impact/direct, required), network_event_id (string, required), signup_email (string, optional), metadata (object, optional).
    name: "record_signup",
    description:
      "Record an affiliate signup conversion event. Call this when one of your end users " +
      "successfully signs up for a referred product. Requires the tracking_code returned " +
      "by generate_tracked_link. Idempotent -- safe to call multiple times with the same " +
      "network + network_event_id.",
    inputSchema: {
      type: "object",
      properties: {
        tracking_code: {
          type: "string",
          description:
            "The tracking code from the affiliate link (returned by generate_tracked_link). " +
            "This ties the signup back to the original referral.",
        },
        network: {
          type: "string",
          description:
            "The affiliate network that reported this event. One of: 'partnerstack', 'impact', 'direct'.",
          enum: ["partnerstack", "impact", "direct"],
        },
        network_event_id: {
          type: "string",
          description:
            "Unique event ID from the affiliate network (or any unique string for 'direct'). " +
            "Used for idempotency -- duplicate calls with the same ID are ignored.",
        },
        signup_email: {
          type: "string",
          description: "Email address the user signed up with (optional but recommended).",
        },
        metadata: {
          type: "object",
          description: "Optional extra data to attach to this event.",
          additionalProperties: true,
        },
      },
      required: ["tracking_code", "network", "network_event_id"],
    },
  • src/index.js:446-453 (registration)
    Dispatch map (HANDLERS) that maps the tool name 'record_signup' to the handler function handleRecordSignup. This is used by the CallToolRequestSchema handler to route incoming tool calls.
    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,
  • The agentfuse helper function used by handleRecordSignup to make the actual HTTP POST request to the AgentFuse API. Handles auth, JSON serialization/parsing, and error handling.
    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;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses idempotency and safety of multiple calls. Without annotations, description provides essential behavioral context about side effects and dependency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences, no waste. Purpose first, then condition, prerequisite, and idempotency. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, trigger, prerequisite, and idempotency. Lacks return value or error handling, but no output schema expected. Adequate for a simple recording tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so description adds limited value. It reinforces tracking_code's role and network_event_id's idempotency use, but doesn't go beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb ('Record'), resource ('affiliate signup conversion event'), and condition ('when user signs up'). Distinguishes from siblings like generate_tracked_link (prerequisite) and get_stats.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to call (signup success) and prerequisite (tracking_code). Mentions idempotency but doesn't explicitly exclude alternatives; however, siblings don't overlap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sai4447/agentfuse-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server