Constructing a linked list

You can to control the mutation depending on the size of the list using variables.
It can be achieved in the following way.
Get the list(Assume ListID is 0x0123)

query {
	getList(id: "0x123") {
		head
		tail
	}
}

After getting the head and tail pointer you can decide if the list is empty.
Empty condition: head = null and tail = null

mutation updateList($patch: UpdateListInput!) {
	updateList(input: $patch) {
		list {
			listID
			head
			tail
		}
	}
}

When the list is empty, $patch

{
	"patch": {
		"filter": {
			"listID": ["0x123"]
		},
		"set": {
			"head": "0x01",
			"tail": "0x01"
		}
	}
}

Update the tail after adding to the List.

{
	"patch": {
		"filter": {
			"listID": ["0x123"]
		},
		"set": {
			"tail": "0x02"
		}
	}
}

Update the head after deletion from the List.

{
	"patch": {
		"filter": {
			"listID": ["0x123"]
		},
		"set": {
			"head": "0x02"
		}
	}
}