Chess Esca
v0.4.1Read chess positions by the rules: legality with its evidence, draws, facts, openings, PGN
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
position
The whole state of a chess position, read by the rules. Answers in one call: whose turn it is, whether that side is in check and from where, whether the game is over and how, which draws are claimable and on what evidence, how many legal moves there are, the opening name if the position has one, the material on each side, both castlings of both colours with every obstacle at once, the en-passant capture on offer, the pins and skewers on the board, and the ending it is where the material makes one. `prose` gathers every sentence the answer carries. Args: fen: the position as FEN or EPD; t…
| Parameter | Type | Description |
|---|---|---|
fen | The position as FEN or EPD; the variant's start position when omitted. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
legal_moves
Every legal move of a position, in SAN and in UCI. Each move carries what it does — the role that moves, whether it captures and what, whether it gives check, what it promotes to, and the static exchange it starts. With `categories`, the same moves are also grouped as captures, checks, castling, promotions, en passant and quiet. Args: fen: the position as FEN or EPD; the start position when omitted. moves: moves played from it, SAN or UCI. pgn: a whole game instead of `fen` and `moves`. variant: 'classic' or 'chess960'. categories: group the moves as well as listing the…
| Parameter | Type | Description |
|---|---|---|
categories | boolean | Also group the moves by what they do. |
fen | The position as FEN or EPD; the variant's start position when omitted. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
explain_move
Whether one move is legal, and what it does or what forbids it. An illegal move answers with every reason that applies at once — no castling right, a rook that is not there, a king in check, an attacked or a blocked path, a pinned unit, an occupied destination, a promotion left unnamed — each carrying the squares it was read off. A legal move answers with what it changes: the capture, the check, the castling or en passant, the promotion, the position after it, and the draws either side could claim once it is played. Args: move: the move, SAN or UCI. fen: the position as FEN or EP…
| Parameter | Type | Description |
|---|---|---|
move * | string | The move, SAN ('exd6', 'O-O') or UCI ('e5d6', 'e1g1'). |
fen | The position as FEN or EPD; the variant's start position when omitted. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
facts
The named facts esca reads off a position, group by group. Every fact is labelled by its own name, and a value that differs between the two sides is written `{"white": …, "black": …}`, so nothing has to be read against whose turn it is. A set of squares is the list of its square names in board order, a set of files the list of its letters, and a value that may be absent is `null`. Where a value is a run of eight or three, `field_notes` says once which end is which. The groups are `state`, `history`, `material`, `pawns`, `pieces`, `king`, `mobility`, `attacks`, `exchange`, `threats`, `tact…
| Parameter | Type | Description |
|---|---|---|
fen | The position as FEN or EPD; the variant's start position when omitted. | |
groups | Which fact groups to read. Every group the esca://facts-catalogue resource lists is allowed; `placement` and `maps` are left out unless asked for. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
ending
The ending the material makes, what theory says it is, and how it is won. An ending is a position where neither side holds more than two pieces, a piece being anything that is neither a king nor a pawn; above that the class is `not_an_ending` and the signature still says what is on the board. The signature writes the stronger side first — `KRPvKR` — the class names the material alone, and the verdict names the colour it favours. The technique is the named method the ending is played by: the box method, the Lucena position, the opposition, the wrong bishop. The `evidence` holds the positio…
| Parameter | Type | Description |
|---|---|---|
fen | The position as FEN or EPD; the variant's start position when omitted. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
opening
The ECO code and name of a position, and of the line that reached it. ECO is the Encyclopaedia of Chess Openings, whose volume letter and index name a known opening. The catalogue is keyed by position, so a line that transposes into a named position is named, and a line that has left the book keeps the last name it reached, which is what `reached` reports. Args: fen: the position as FEN or EPD; the start position when omitted. moves: moves played from it, SAN or UCI. `reached` needs them. pgn: a whole game instead of `fen` and `moves`. variant: 'classic' or 'chess960'. Retur…
| Parameter | Type | Description |
|---|---|---|
fen | The position as FEN or EPD; the variant's start position when omitted. | |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
book_moves
The moves a Polyglot opening book holds for a position. Polyglot is the opening-book format whose 16-byte entries are keyed by a hash of the position, so a book written by any program that speaks it can be read here. No book is bundled: `book` names one of your own. Args: book: path to a `.bin` Polyglot book. fen: the position as FEN or EPD; the start position when omitted. moves: moves played from it, SAN or UCI. pgn: a whole game instead of `fen` and `moves`. variant: 'classic' or 'chess960'. limit: how many entries to return, heaviest first. Returns: dict: `bo…
| Parameter | Type | Description |
|---|---|---|
book * | string | Path to a Polyglot opening book, a `.bin` file. |
fen | The position as FEN or EPD; the variant's start position when omitted. | |
limit | integer | How many entries to return, heaviest first. |
moves | Moves played from `fen`, each SAN ('Nf3') or UCI ('g1f3'). Repetition and fifty-move claims are only visible with the moves that led here. | |
pgn | A whole game as PGN, instead of `fen` and `moves`. | |
variant | string | The rules: 'classic' or 'chess960'. |
pgn
A PGN game read into its headers, its moves and where it ended up. PGN is Portable Game Notation, the text a game is saved and shared in. Comments, numeric glyphs and variation counts are kept where the source has them; the moves reported are the mainline. Args: text: the PGN source; it may hold more than one game. index: which game to read, counting from 0. Returns: dict: `games_in_source`, `index`, `headers`, `comment`, `result`, `variant`, `start_fen`, `moves` — each `san`, `uci`, `nags`, `comment_before`, `comment_after`, `variations` — `ply`, `final_fen`, `o…
| Parameter | Type | Description |
|---|---|---|
text * | string | The game as PGN: tag pairs, a blank line, the movetext. |
index | integer | Which game of the source to read, from 0. |
to_pgn
A list of moves written out as a PGN game. Args: moves: the moves, SAN or UCI. fen: the start position; the variant's own when omitted. variant: 'classic' or 'chess960'. headers: tag pairs to set on the game. result: the termination marker; read from the final position when omitted. Returns: dict: `pgn`, `final_fen`, `ply`, `result`, `opening` — or `error` when a move is not legal where it stands.
| Parameter | Type | Description |
|---|---|---|
moves * | array | The moves of the game, each SAN ('Nf3') or UCI ('g1f3'). |
fen | The position as FEN or EPD; the variant's start position when omitted. | |
headers | Tag pairs to set, such as White, Black, Event, Date. | |
result | The termination marker: '1-0', '0-1', '1/2-1/2' or '*'. | |
variant | string | The rules: 'classic' or 'chess960'. |