Skip to main content
Glama

Validate Gift Code

horizon_validate_gift_code
Read-onlyIdempotent

Check if a gift code can be redeemed by a player before claiming it, without consuming it. Confirms typed codes early and returns valid=false for expired, revoked, or limited codes.

Instructions

Checks whether a gift code can be redeemed by this player right now, without using it up. Use when: before horizon_redeem_gift_code, for example to confirm a code the player typed and show an error early. Not for: claiming the reward (use horizon_redeem_gift_code; validating alone grants nothing). Requires: a userId from horizon_signup_* or horizon_signin_*; no session token. Side effects: None (read only); no redemption is used. Returns: {valid}. valid false means the code does not exist, has expired, was revoked or reached its limit for this player or in total; tell the player the code does not work. Errors: Needs HORIZON_API_KEY. Every failure returns an error result (isError) with the HTTP status and body: a 401 that horizon_test_connection also returns means HORIZON_API_KEY is wrong, 429 means the account's per-minute rate limit was reached (wait a minute, then retry).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesGift code as the player typed it (max 50 characters)
userIdYesPlayer user ID (UUID) from horizon_signup_* or horizon_signin_*

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
validNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.6.0
    • changedInput schema / properties / code / description
      Previous value: -"Gift code to validate (max 50 characters)"New value: +"Gift code as the player typed it (max 50 characters)"
    • addedInput schema / properties / code / minLength
      Added value: +1
    • changedInput schema / properties / userId / description
      Previous value: -"User ID (UUID) returned by a horizon_signup_* or horizon_signin_* tool"New value: +"Player user ID (UUID) from horizon_signup_* or horizon_signin_*"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "valid": {
      +      "anyOf": [
      +        {
      +          "description": "true when the player can redeem the code now",
      +          "type": "boolean"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changedv1.5.5
    • changedInput schema / properties / userId / description
      Previous value: -"User ID (UUID)"New value: +"User ID (UUID) returned by a horizon_signup_* or horizon_signin_* tool"
  3. First observedv1.5.4

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover read-only/idempotent/non-destructive, but the description adds genuinely new behavioral context: no redemption is consumed, no session token is required, the exact error contract (isError with HTTP status/body), how to interpret a 401 vs horizon_test_connection, and 429 rate-limit retry handling. This goes well beyond the structured hints.

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?

Uses labeled sections (Use when / Not for / Requires / Side effects / Returns / Errors) that are strongly front-loaded and skimmable. Despite its length, every sentence carries actionable content with no filler.

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?

Covers prerequisites (userId source), auth requirements (HORIZON_API_KEY), side-effect profile, return interpretation, and error handling. An output schema exists so return details are a bonus rather than a requirement, and the description still clarifies the critical valid=false case.

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% and both parameters are already documented in the schema (including the UUID format, pattern, and signup/signin origin). The description restates the userId origin and adds that no session token is needed, but provides no new per-parameter syntax, so the baseline of 3 applies.

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 ('checks whether...can be redeemed') and resource (gift code), plus explicit scope ('without using it up'). Explicitly distinguishes itself from horizon_redeem_gift_code, so an agent can pick it apart from its sibling without opening either schema.

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?

Provides explicit 'Use when' (before redemption, to confirm a typed code and surface errors early) and 'Not for' (claiming the reward; validating grants nothing) guidance, naming the alternative tool directly. Nothing is left to inference.

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