Expand description
The game’s side of shuyi mcp: shuyi mcp-host, run in the game’s
tool program, answers the server’s Requests, one JSON line each on
stdin, with a Reply line each on stdout, after the mark REPLY. It answers the
operations that run the game with the game’s tools, and keeps the
session’s game (Host).
InProcess is the same host without a process between, for games’
and the engine’s tests of the server.
Structs§
- Host
- The game’s side of the server: the game’s tools on its project, and the session’s game, if one is running.
- InProcess
- The host in this process: a
Launchwhose game istools, with no process between, for tests of the server. - Reply
- What the host answers.
- Request
- What the server asks the host: the tool of
op, with its input.
Constants§
- REPLY
- What starts each reply line, so the server tells replies from what the game prints itself.
Functions§
- answered
inputread asI(nothing given reads as{}), andf’s answer to it; acodes::WRONG_ARGUMENTSanswer ofopif it doesn’t read.- failed
- The answer of
opthat failed withcodebecause oferror, as JSON. - no_
session - The answer of session tool
opwith no game running. - one_off
- The answer of the operation
op(one ofOp::ALL) toinput, as JSON: with the game’s toolsgameonprojectwhere it runs the game;newmakes its folder fromcwd, andimportreads from the project’s root, orcwdoutside one. Without the game’s tools or a project, an operation that needs them says so, as the CLI does. - serve
shuyi mcp-host: answers each request line ofinputonoutputwithgame’s tools onproject, untilinputends. Returns the exit code: 0, or 1 if a line couldn’t be read or written.- to_json
answeras JSON.