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.

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)
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. First observed

TDQS

A4.6/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 disclosure burden and does it well: 1 CRD per call charged even on rejection, but a 429 RATE_LIMITED costs nothing. It also lists the 400 error codes (ALREADY_REFERRED, SELF_REFERRAL, INVALID_REFERRAL_CODE, program inactive), the one-referral-per-program rule, the replay/idempotency semantics, and the request_id to quote for 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?

Front-loaded with the core action and effect, then parameters, then constraints, then cost and errors. The sentences are dense and occasionally crammed (parenthetical default and replay clauses), but nearly every clause carries operational value.

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

Completeness5/5

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

No output schema exists, so the description takes on return semantics itself by naming the replayed flag and the shape of error results including request_id. For a 7-parameter mutation with billing implications, this covers cost, idempotency, limits, failure modes, and the deferral workflow.

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 already 100%, yet the description adds real meaning: credit_type_id determines which program pays and defaults to the project default program, and defer_referrer_credits changes payout timing rather than just being a boolean flag. It also explains that a retry with the same code replays with replayed: true. It does not touch api_key, project_id, or x402_payment, but those are self-explanatory from 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?

States a specific verb and resource ('Apply a referral code for a referred user') plus the effect: issuing configured credits to referee and referrer. It also distinguishes the sibling complete_referral by explaining that the referral stays pending until that tool 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 Guidelines4/5

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

Gives clear context for the two optional parameters: credit_type_id selects the program (defaulting to the project default) and defer_referrer_credits pays only the referee now. It names complete_referral as the follow-up but never states when to use generate_referral_code or list_referrals instead, so the sibling routing is implied rather than explicit.

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