Skip to main content
Glama

Save Cloud Data

horizon_save_cloud_data
DestructiveIdempotent

Stores a player's game save as a string in the cloud, replacing the previous save and returning a new revision so later saves can avoid overwriting progress from another device.

Instructions

Stores a player's save game as one string (usually JSON) on the server, replacing the player's previous save. Use when: the game saves progress so it survives reinstalls and can be loaded on another device. Pass expectedRevision (the revision from horizon_load_cloud_data or the last save) so a save from another device is never overwritten silently. Not for: reading the save (use horizon_load_cloud_data) or server-owned currency that players must not edit (use Validated Actions: horizon_submit_validated and horizon_get_state). Requires: userId and the player's session: sign in with horizon_signin_email or horizon_signin_anonymous and pass its accessToken as sessionToken. Side effects: overwrites the player's single save slot; the old save is gone. With expectedRevision it only writes while the save is still at that revision. Saving the same data again changes nothing. Returns: {success: true, dataSizeBytes, revision}. revision is the new revision: pass it as expectedRevision to the next save. Errors: 409 (only with expectedRevision) when another device saved first: nothing was written, load the current save and revision, decide, then save again. 403 when the data exceeds the tier limit: read cloudSaveBytes in horizon://api/feature-limits for the hosted account's tier. 401 means the session is missing or expired: sign in again and retry with the new accessToken. 403 for a session means the token belongs to another user: pass the userId that signed in. 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).

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": {
      "userId": "<userId>",
      "data": "<data>",
      "sessionToken": "<sessionToken>"
    },
    "name": "horizon_save_cloud_data"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYesThe complete save as a string, usually serialized JSON (max 300,000 characters; the tier limit is usually lower)
userIdYesPlayer user ID (UUID) from horizon_signup_* or horizon_signin_*
sessionTokenYesaccessToken from horizon_signin_email or horizon_signin_anonymous for this userId; sent as a Bearer session
expectedRevisionNoOptional. Revision the save must still have, sent as If-Match: 0 for an empty slot, else the revision from horizon_load_cloud_data or the last save. Omit for an unconditional overwrite.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.9.1
    • addedInput schema / properties / expectedRevision
      Added value: +{
      +  "description": "Optional. Revision the save must still have, sent as If-Match: 0 for an empty slot, else the revision from horizon_load_cloud_data or the last save. Omit for an unconditional overwrite.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  2. Changed3 schema fields changedv1.6.0
    • changedInput schema / properties / data / description
      Previous value: -"Save data string, usually serialized JSON (max 300,000 characters; the tier limit is usually lower)"New value: +"The complete save as a string, usually serialized JSON (max 300,000 characters; the tier limit is usually lower)"
    • changedInput schema / properties / sessionToken / description
      Previous value: -"accessToken returned by horizon_signin_email or horizon_signin_anonymous for this user; sent as a Bearer session"New value: +"accessToken from horizon_signin_email or horizon_signin_anonymous for this userId; sent as a Bearer session"
    • 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_*"
  3. Changed4 schema fields changedv1.5.5
    • changedInput schema / properties / data / description
      Previous value: -"Save data string (max 300,000 characters)"New value: +"Save data string, usually serialized JSON (max 300,000 characters; the tier limit is usually lower)"
    • addedInput schema / properties / sessionToken
      Added value: +{
      +  "description": "accessToken returned by horizon_signin_email or horizon_signin_anonymous for this user; sent as a Bearer session",
      +  "maxLength": 256,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / userId / description
      Previous value: -"User ID (UUID)"New value: +"User ID (UUID) returned by a horizon_signup_* or horizon_signin_* tool"
    • changedInput schema / required
      Previous value: -[
      -  "userId",
      -  "data"
      -]New value: +[
      +  "userId",
      +  "data",
      +  "sessionToken"
      +]
  4. First observedv1.5.4

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructive=true and idempotent=true, but the description goes well beyond them: it names the single-slot overwrite ('the old save is gone'), explains the optimistic-concurrency guard via expectedRevision, and confirms the idempotent behavior ('Saving the same data again changes nothing'). It also discloses auth requirements, the 409 conflict path, tier-limit 403s, and 429 rate limiting.

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 labeled-section structure (Use when / Not for / Requires / Side effects / Returns / Errors) makes a long definition scannable, and the purpose and trigger are front-loaded. The error paragraph is dense and discusses two different 403 meanings, which costs a point on tightness, but nearly every sentence carries actionable information.

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?

For a destructive write with no output schema, the description supplies the return shape ({success, dataSizeBytes, revision}), the concurrency contract, the preconditions (HORIZON_API_KEY plus a sign-in flow for sessionToken), and status-code triage including the distinction between an API-key 401 and a session 401. Nothing needed to call it correctly is missing.

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 schema already documents all four parameters, making 3 the baseline. The description earns a fourth point by explaining the *why* of expectedRevision — preventing a silent cross-device overwrite — and by stating that the returned revision should be fed into the next save, which is semantics the schema alone does not convey.

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?

Opens with a specific verb and resource ('Stores a player's save game as one string... replacing the player's previous save'), and immediately distinguishes itself from horizon_load_cloud_data and the validated-action tools. An agent can identify the operation and its scope without opening the 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?

Explicit 'Use when' and 'Not for' sections name the alternatives (horizon_load_cloud_data for reading, horizon_submit_validated/horizon_get_state for server-owned currency that players must not edit). The guidance covers both the positive trigger and the misleading near-misses.

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

Deploy Server

Other Tools