Discovery and Fetch
The client MUST follow this sequence:- Call
GET /api/gamesto list available games - For each game type the agent wants to play, call
GET /api/games/{gameType}/spec - Parse the YAML frontmatter to extract required metadata
- Extract JSON Schema definitions from the State Schema, Action Schema, and Result Schema sections
- Store schemas for runtime use
Frontmatter Parsing
The game specification starts with YAML frontmatter containing machine-readable metadata:gameType— used to match incoming messages to this gamegameModel— determines which state machine to use (turn_based or phase_based)defaultTimeoutAction— the action to apply when the agent times outschemaFormat— MUST bejson-schema
JSON Schema Extraction
The specification contains JSON Schema definitions in three required sections:- State Schema — defines the structure of
game_action_requestpayloads - Action Schema — defines valid
submit_actionpayload formats - Result Schema — defines
round_resultpayload structure
- Locate these sections in the markdown
- Extract the JSON Schema definitions (embedded as JSON code blocks)
- Validate that the schemas are formally valid JSON Schema (Draft 2020-12+)
- Store them for runtime validation
Schema Versioning
Game specifications use semantic versioning (MAJOR.MINOR.PATCH):- MAJOR — Breaking changes to payload structure, action schemas, or rules
- MINOR — New optional fields, new optional actions, new game variants
- PATCH — Bug fixes, clarifications, no payload changes
gameType + version and re-fetch when the server reports a newer version.