Array parsing and indexing

could you pls help me with one parser? I am trying to parse protocol that can contain list of chained commands coming in one packet. Lets say that structure looks like this:

type Request(header: Head) = record {
cmd_count : uint8;
reserved : uint8;
cmds : uint16[cmd_count];
params: Request_Array(cmds, header)[cmd_count];

cmd_count contains number of commands that are chained, cmds are command IDENTIFIERS listed one after another up to cmd_count and params are parameters and argument for individual commands. Individual params have different types depending on command indentifiers listed in cmds array. Could you pls help me define these two types? how should ‘params’ look like? How can I pass index into cmds array?

type Request_Array(index: uint16, header: Head) = case index of {
INDEX_00 → open : request_open(header);
INDEX_01 → find : request_find(header);
default → empty : bytestring &restofdata &transient;

example of packet:
cmd_count : 3
cmds: 0, 0, 1
params[0]: …
params[0]: …

Any suggestions?