# Play NetHack with this server
You are playing a real NetHack game through the tools on this server. Play
autonomously until the game ends, and tell the user what happened.
## Connect
The remote MCP endpoint is `{{MCP_URL}}`. Add it as a Streamable HTTP MCP
server in your agent environment. The server exposes `new_game`, `observe`,
`press`, `select_menu`, `respond`, and `quit_game`.
Reading this page does not connect the MCP tools. If you cannot call them,
tell the user that the remote MCP server needs to be connected. The
spectator pages cannot control a game.
## Start a game
Call `new_game` once with `model_slug` set to a short, printable ASCII
name for your model slug. You may also provide a character `name`. The
result contains `game_id`, `control_token`, `viewer_url`, and the
first `state`. Keep `game_id` and `control_token` for subsequent tool
calls. Share the `viewer_url` with the user before continuing, but do
not publish the control token or put it in a URL. If creation is rate
limited or the server is full, report that instead of repeatedly
creating games.
## Play the game
Use the returned `state`, then call `observe` as needed. Read its `map`,
`status`, `messages`, `inventory`, `lifecycle`, `operation`, and `pending`
fields before choosing an action. NetHack movement uses `h`, `j`, `k`, `l`
for left, down, up, right, and `y`, `u`, `b`, `n` for diagonals.
Every gameplay call needs the current `game_id` and `control_token`. For
`press`, `select_menu`, or `respond`, also pass the latest
`pending.input_id`:
- For `pending.kind = "key"`, call `press` with one printable ASCII character
or a named key such as `ENTER`, `ESC`, `SPACE`, or `CTRL_A`.
- For `pending.kind = "menu"`, call `select_menu` with `selections` containing
the desired selectable entries, such as `[{"entry_id": 1}]`. Pass an empty
array if choosing none, or use `cancel: true` with an empty array to cancel.
- For `pending.kind = "text"`, `"choice"`, `"command"`, or `"acknowledge"`,
call `respond` with exactly one matching field: `text`, `choice`,
`command`, or `acknowledge: true`. Use offered choices and commands.
Read the state returned by each action. If an operation is still running or
no input is pending, wait briefly and call `observe` again. Do not send an
action for an old `input_id`. Only the ten most recent messages are retained;
read each response and use `after_message_id` to avoid repeating messages.
Use `quit_game` only when you intentionally want to end the run.
When `lifecycle` becomes `ended` or `failed`, stop issuing gameplay actions
and report the outcome to the user. Keep the spectator link available while
the game is active.
## Game knowledge
The goal of the game is to go down to the lowest level of the dungeon,
and then go up to ascend. You can more info on how to play NetHack at
https://www.nethack.org/download/5.0.0/nethack-500-Guidebook.txt and
https://nethackwiki.com/wiki/Guidebook .