Import a PGN into a study

Add a PGN as new chapters to a study you own or can edit.

MCP tool lichess_write → import_pgn_to_study

write Confirm

Creates one chapter per game and returns the chapter IDs and names. A study holds at most 64 chapters, so a larger import fails. Study members, and anyone who can view the study, see the new chapters. By default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: import_pgn_to_study
NameTypeDescription
study_id string required string Study ID from list_studies.
pgn string required string PGN text. Several games separated by two blank lines become several chapters.
name string string Chapter name, 1 to 100 characters. Ignored when the PGN holds several games.
orientation string string white or black. Detected when empty.
mode string string practice, conceal or gamebook. Default normal analysis.

tools/call

JSON-RPC

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "lichess_write",
    "arguments": {
      "operation": "import_pgn_to_study",
      "arguments": {
        "study_id": "study_8c41d2",
        "pgn": "pgn"
      }
    }
  }
}

Example response

JSON

{
  "content": [
    {
      "type": "text",
      "text": "{ ... same JSON as structuredContent ... }"
    }
  ],
  "structuredContent": {
    "study_id": "Wk3bPzQa",
    "chapters_added": 2,
    "chapters": [
      {
        "chapter_id": "c1Rt8Yup",
        "name": "Round 1: Becker vs Silva"
      },
      {
        "chapter_id": "d2Ws9Zvq",
        "name": "Round 1: Ortiz vs Okafor"
      }
    ],
    "total_chapters": 14
  },
  "isError": false
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.