publish_cloud_code
Publish server-side game logic (CloudCode) and make it live. This is the only way to run custom code on the server, and the only way to write protected data: the ReadOnly/Internal buckets of a player's UserCustomData and the Runtime scope of the title's data store. The script is plain JavaScript ...
This record as markdown: /tools/com-idosgames-platform/publish-cloud-code.md
What publish_cloud_code does on iDos Games
AI agents use publish_cloud_code to create or update resources in iDos Games, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your iDos Games environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Full JavaScript source of the revision. |
comment | string | — | Short note about what changed. |
handlers | array | — | Optional whitelist of callable handlers; anything not listed is rejected by the server. |
title_id | string | Yes | TitleID. |
Parameters from the server's own tool schema.
Why publish_cloud_code is rated Medium
An AI agent can call publish_cloud_code faster than any human can review: one bad instruction and it creates or modifies resources in iDos Games by the hundred, each call as confident as the last.
Risk signalsAccepts freeform code/query input (code)
Attacks that exploit this kind of access
The rule that runs publish_cloud_code safely
PolicyLayer is an MCP gateway: it sits between your AI agents and iDos Games, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For publish_cloud_code, this is the rule to start with:
publish_cloud_code stays usable, but capped: an agent stuck in a loop can't make hundreds of changes a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect iDos Games, apply this rule, and every publish_cloud_code call is checked against it from then on.
Questions about publish_cloud_code
Publish server-side game logic (CloudCode) and make it live. This is the only way to run custom code on the server, and the only way to write protected data: the ReadOnly/Internal buckets of a player's UserCustomData and the Runtime scope of the title's data store. The script is plain JavaScript filling a global 'handlers' object, e.g. handlers.claimDailyBonus = function (args, context) { … }. Inside a handler: log.Info/Warning/Error, context.UserID, and server.* (ReadUserData, GetTitleConfig, GetUserCustomData, SetUserCustomData, DeleteUserCustomData, BatchSetUserCustomData, BatchDeleteUserCustomData, GetPublicUserCustomDataOf, GetTitleCustomData, SetTitleCustomData, IncrementTitleCustomData, DeleteTitleCustomData, BatchSetTitleCustomData, BatchDeleteTitleCustomData, GetIntegrationVariable, HttpRequest) — each returns { Success, Error, Data }. No async/await, no imports; 10 seconds wall-clock per call and a per-execution cap on server.* calls. The only way out to the network is server.HttpRequest({ Method, Url, Headers, Body }) — there is no fetch and no XMLHttpRequest; it reaches only publisher-allow-listed hosts over https, and credentials go in as {{secret:NAME}} placeholders (see list_title_secrets), never as literal values. The code REPLACES the previous revision entirely — read get_cloud_code first and send back the full script. Games call handlers through the SDK's client.cloudCode.execute(name, args). It is categorised as a Write tool in the iDos Games MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
publish_cloud_code accepts 4 parameters: code, comment, handlers, title_id. Required: code, title_id. The full parameter table on this page comes from the server's own tool schema.
Register the iDos Games MCP server in PolicyLayer and add a rule for publish_cloud_code: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches iDos Games. Nothing to install.
publish_cloud_code is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the publish_cloud_code rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for publish_cloud_code. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
publish_cloud_code is provided by the iDos Games MCP server (https://site.idosgames.com/api/v2/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on iDos Games, and thousands of servers like it.
This server
Across the catalogue