Skip to main content
Glama

apply_referral

Apply a referral code for a referred user, issuing the configured credits to the referee and the referrer. credit_type_id picks the credit type's program (default: the project's default program). defer_referrer_credits pays only the referee now; the referral stays pending until complete_referral pays the referrer. A user can be referred once per program (without credit_type_id: in the default program); a credit_type_id retry with the same code replays (replayed: true): errors 400 ALREADY_REFERRED, SELF_REFERRAL, INVALID_REFERRAL_CODE, or program inactive. Costs 1 CRD (platform credit) per call, charged even when the call is then rejected (a 429 RATE_LIMITED costs nothing). Error results include request_id; quote it to support.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "user_id": "<user_id>",
      "referral_code": "<referral_code>"
    },
    "name": "apply_referral"
  }
}

Input Schema

NameRequiredDescriptionDefault
api_keyNoCred API key (optional if set via the x-api-key header)
user_idYesExternal user ID of the referred user
project_idNoCred project ID (optional; the API key already identifies the project. Signed in with 1Profile and owning several projects, it picks one)
x402_paymentNoBase64 x402 PaymentPayload, only when a previous call failed with an x402 PaymentRequired because the account is out of CRD
referral_codeYesThe referrer's code
credit_type_idNoCredit type whose program pays
defer_referrer_creditsNoHold the referrer's credits until complete_referral

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / project_id / description
      Previous value: -"Cred project ID (optional; the API key already identifies the project)"New value: +"Cred project ID (optional; the API key already identifies the project. Signed in with 1Profile and owning several projects, it picks one)"
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses the 1 CRD per-call cost that is charged even on rejection, the 429 exception that costs nothing, the pending/replay state machine, the enumerated error codes (ALREADY_REFERRED, SELF_REFERRAL, INVALID_REFERRAL_CODE, program inactive), and that error results carry a request_id to quote to support.

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?

Purpose and cost are front-loaded, and every sentence adds a distinct fact (defaults, defer semantics, uniqueness/replay, errors, pricing). It is dense with parentheticals and reads as one long paragraph, which slightly hurts scanability, but there is no filler.

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?

For a 7-param mutation with no annotations and no output schema, the definition covers cost, idempotency/replay, deferred lifecycle, error codes, and support escalation. What is missing is what a successful call returns (issued amounts, referral identifiers) and whether retries without credit_type_id are safe.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning for two params: credit_type_id selects that credit type's program with the project's default program as fallback, and defer_referrer_credits is tied to the pending/complete_referral lifecycle. The other params (user_id, referral_code, api_key, project_id, x402_payment) are left entirely to the 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?

The opening sentence gives a specific verb and resource ('Apply a referral code for a referred user') plus the effect ('issuing the configured credits to the referee and the referrer'). It also implicitly separates this from complete_referral by noting that deferred referrals 'stay pending until complete_referral pays the referrer'.

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

Usage Guidelines5/5

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

It states the conditions of use (once per program; a credit_type_id retry with the same code replays), names complete_referral as the follow-up for the deferred case, and explains when to pass credit_type_id vs omit it. The alternatives and exclusions are explicit rather than inferred.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources