Skip to main content
Glama

referrals

Manage referral programs to earn USDC commissions by referring agents and providers on the402.ai marketplace. Track referrals, view earnings breakdowns, and withdraw commissions using API actions.

Instructions

Manage your referral program on the402.ai. Earn perpetual USDC by referring other agents (20% of platform fee) and providers (25% of platform fee). Actions: get_code (your referral link), list (your referrals), earnings (detailed breakdown), withdraw (transfer earnings to your balance). Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesget_code = get your referral code/link, list = see who you referred, earnings = detailed breakdown, withdraw = transfer to balance

Implementation Reference

  • The handler function for the 'referrals' tool, which dispatches based on the 'action' argument.
    async ({ action }) => {
    	switch (action) {
    		case "get_code": {
    			const result = await client.authGet("/v1/referrals/code");
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    		case "list": {
    			const result = await client.authGet("/v1/referrals");
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    		case "earnings": {
    			const result = await client.authGet("/v1/referrals/earnings");
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    		case "withdraw": {
    			const result = await client.authPost("/v1/referrals/withdraw");
    			return {
    				content: [
    					{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    				],
    			};
    		}
    	}
    }
  • Input schema validation using zod for the 'referrals' tool.
    {
    	action: z
    		.enum(["get_code", "list", "earnings", "withdraw"])
    		.describe(
    			"get_code = get your referral code/link, list = see who you referred, earnings = detailed breakdown, withdraw = transfer to balance"
    		),
    },
  • Registration of the 'referrals' tool within the McpServer.
    server.tool(
    	"referrals",
    	"Manage your referral program on the402.ai. Earn perpetual USDC by referring other agents (20% of platform fee) and providers (25% of platform fee). Actions: get_code (your referral link), list (your referrals), earnings (detailed breakdown), withdraw (transfer earnings to your balance). Requires API key.",
    	{
    		action: z
    			.enum(["get_code", "list", "earnings", "withdraw"])
    			.describe(
    				"get_code = get your referral code/link, list = see who you referred, earnings = detailed breakdown, withdraw = transfer to balance"
    			),
    	},
    	async ({ action }) => {
    		switch (action) {
    			case "get_code": {
    				const result = await client.authGet("/v1/referrals/code");
    				return {
    					content: [
    						{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    					],
    				};
    			}
    			case "list": {
    				const result = await client.authGet("/v1/referrals");
    				return {
    					content: [
    						{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    					],
    				};
    			}
    			case "earnings": {
    				const result = await client.authGet("/v1/referrals/earnings");
    				return {
    					content: [
    						{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    					],
    				};
    			}
    			case "withdraw": {
    				const result = await client.authPost("/v1/referrals/withdraw");
    				return {
    					content: [
    						{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    					],
    				};
    			}
    		}
    	}
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses that it 'Requires API key' (auth needs) and mentions earnings percentages, but lacks details on rate limits, error handling, or what 'withdraw' entails (e.g., fees, timing). For a tool with mutation actions like 'withdraw,' this is insufficient behavioral context.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose. It uses bullet-like formatting for actions, which is efficient. However, the earnings percentages could be integrated more smoothly, and the sentence structure is slightly cluttered.

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

Completeness3/5

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

Given no annotations and no output schema, the description partially compensates by explaining actions and auth needs. However, for a tool with mutation capabilities (e.g., 'withdraw'), it lacks details on return values, error cases, or side effects, leaving gaps in completeness.

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 description coverage is 100%, with the 'action' parameter fully documented in the schema. The description adds minimal value by listing the actions in a slightly different format, but doesn't provide additional semantics beyond what the schema already covers. Baseline 3 is appropriate given high schema coverage.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Manage your referral program on the402.ai' with specific actions listed. It distinguishes itself from siblings by focusing on referral management, which is unique among the listed tools. However, it doesn't explicitly contrast with similar tools (none exist in siblings), so it's not a perfect 5.

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

Usage Guidelines3/5

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

The description implies usage context through 'Manage your referral program' and 'Requires API key,' suggesting when to use it. However, it lacks explicit guidance on when to choose this tool over alternatives (though no direct alternatives exist in siblings) or any exclusions. The guidelines are present but not comprehensive.

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/the402ai/mcp-server'

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