Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
TWMCP_VIEW_HOSTNoLive-view server bind host (default `127.0.0.1`)127.0.0.1
TWMCP_VIEW_PORTNoLive-view server port (default `4571`, auto-increments if busy)4571
TWMCP_CHROME_PATHNoChrome executable if `channel: 'chrome'` cannot find it
TWMCP_DOWNLOAD_DIRNoFolder where browser downloads are captured~/.cache/twine-play-mcp/downloads

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

DISPLAY POLICY — how to let the user watch a game (follow this to avoid stacking windows on their screen): • Show at most ONE view per game. Pick exactly one method; never combine them. • Default: call live_view(game_id) and give the user the returned URL; pass open:true only if they asked you to open it for them. Auto-open happens at most once per game. • Only if the user explicitly asks for a real browser window: open_game with headless:false. Do not also open a live view for the same game. • screenshot is a one-shot visual check, never a stream — do not loop it to "show" the user the game. • If a view is already open, reuse it (live_view returns the same URL without launching anything new). GAME ID: game_id is optional while exactly one game is open — omit it for less noise.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
open_gameA

Open a Twine / interactive-fiction game and return the first observation. Accepts a local .html file, a folder, or an http(s) URL. Local games are served over 127.0.0.1 so saves work.

observeA

Read the current passage: text, choices, inputs, dialog, status. Pass for_text or wait_ms to wait first — timed passages need no second call. Inputs are paginated in windows of 40.

chooseA

Click a passage choice by 1-based number from the last observation, or by (partial) label. Numbered choices include dialog buttons (tagged [dialog]). Pass expected to guard against clicking the wrong link.

click_uiA

Click sidebar buttons and menus by ref, CSS selector or visible text. Text matching covers controls (SugarCube radio/checkbox options). Use choose() for numbered passage choices.

interactB

Set an input/textarea/select by ref, or press a key ("Enter", "ArrowUp"). Radios/checkboxes take "true"/"false". Refs come from the last observation or find_ui.

navigateA

back: undo one passage (SugarCube/Harlowe). restart: start over, optionally reseeded. goto: jump straight to a named passage — QA only, it skips the path there.

snapshotA

Branch exploration: save stores the current state under a name, load restores it, list shows what exists. Native on SugarCube, Chapbook and Snowman; Harlowe reports unsupported.

find_uiA

Find visible controls (buttons, links, labels, inputs) by text and/or input name; returns refs for click_ui/interact. Pass selector to inspect one DOM subtree, or discover:true to list overlay panels (mod GUIs).

get_variablesA

Read SugarCube State.variables by dot path, e.g. ["haircolour", "player.background"]; "V.x" and "variables.x" also work. No paths: shallow top-level key summary. Other formats have no readable store.

playA

Run several actions in one call and get one compact log plus the final observation, instead of a full observation per step. Tokens: 3 or "label" (choose), "wait 800", "back", "restart", "goto ", "click ", "fill = ", "# note". Stops at the first failure.

engineA

Read engine state without re-rendering the page: passage, turns, variable count, visited passages, or specific variable paths. ~160 bytes where an observation costs ~1.5 KB. SugarCube, Chapbook and Snowman; Harlowe reports unsupported.

get_logsA

JS exceptions, console errors and HTTP failures this page produced. For what the agent did, use engine(include:"actions").

upload_fileA

Upload a local file (mod .zip, .save, image) into an . Pass trigger to click the button that opens the picker, or file_input for the input itself. Searches all frames when neither is given.

download_fileB

Every browser download is captured into a persistent folder. list: show it. save: copy a captured file (pass trigger to click the game's export button first). newest: take the newest capture.

screenshotA

PNG of the game viewport — canvas games, visual QA. Pass path to save it to disk instead of returning the image. One-shot: use live_view to let the user watch.

live_viewA

Show the user the real page the agent drives: a local URL streaming JPEG frames (~1/s) plus passage, step, actions. Works headless. open:true launches the default browser. Repeat calls return the same URL.

sessionB

list: the open games (id, title, format, step, source). close: shut one down, including its browser context and static server. close_all: shut every game down.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.6/5.0

Scored across 17 tools

Disambiguation4/5

Most tools have clearly distinct roles, and the descriptions explicitly draw boundaries between near-neighbors (observe vs engine, choose vs click_ui, screenshot vs live_view, get_logs vs engine). A few pairs still require careful reading — find_ui vs click_ui vs interact, and play vs choose — but an agent can pick correctly with the descriptions provided.

Naming Consistency3/5

The set mixes verb_noun names (open_game, click_ui, find_ui, get_variables, get_logs, upload_file, download_file) with bare verbs and nouns (snapshot, observe, choose, interact, navigate, play, engine, screenshot, live_view, session). It stays readable and snake_case throughout, but there is no single predictable pattern to rely on.

Tool Count4/5

Seventeen tools is on the heavy side, but the domain genuinely spans browser lifecycle, observation, action, state inspection, file transfer, and visual QA, and each tool maps to a real need. A couple of overlaps (screenshot/live_view, snapshot/download_file) suggest slight trimming could help, but nothing feels redundant.

Completeness4/5

The surface covers the full play loop: open, observe, act, navigate/undo/restart, batch actions, variable/state inspection, logs, uploads/downloads, screenshots, live view, and session teardown. Minor gaps exist — no direct DOM/HTML dump or passage-source read, and no explicit save-management tool beyond download_file triggers — but agents can work around these.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues