Skip to content

COMMAND

Returns information about registered server commands.

COMMAND [subcommand [arguments]]

Returns information about all commands that have a definition.

COMMAND

Returns information about one or more commands. Without names, it returns all commands. Names are matched without regard to case. A subcommand is named container|subcommand, for example kr.admin|describe-cluster. An unknown name gives a null entry in its position.

COMMAND INFO [command ...]
ParameterTypeRequiredDescription
commandstringNoOne or more command names to query

Returns the number of commands that have a definition.

COMMAND COUNT

Returns documentation for commands. Without names, it returns all documented commands. With names, it returns only those. Names are matched without regard to case. A subcommand is named container|subcommand. Unknown names are skipped.

COMMAND DOCS [command ...]
ParameterTypeRequiredDescription
commandstringNoOne or more command names to query

Returns the names of all commands, subcommands included. A filter keeps only part of the list.

COMMAND LIST [FILTERBY MODULE name | ACLCAT category | PATTERN pattern]
FilterDescription
MODULECommands of a module. The result is always empty, see below
ACLCATCommands in an ACL category, for example read or bucket. An unknown category gives nothing
PATTERNCommands whose name matches a glob pattern, without regard to case

Kronotop has no module system. The MODULE filter is accepted so that clients written for the standard command set keep working. Any module name gives an empty array, the same reply a server without that module would give.

Returns the key arguments of a full command. The command is given as it would be sent to the server.

COMMAND GETKEYS command [arg ...]

Same as COMMAND GETKEYS, but each key comes with the access flags of its key specification.

COMMAND GETKEYSANDFLAGS command [arg ...]

Returns a short description of every subcommand.

COMMAND HELP
  • COMMAND / COMMAND INFO: Array of arrays, one per command, each containing:
PositionFieldTypeDescription
1namestringCommand name, lowercase. Subcommands are named container|subcommand
2arityintegerNumber of arguments. Negative means “at least”
3flagssetLowercase command flags such as readonly, write, fast
4first keyintegerPosition of the first key argument, 0 when the command has no keys
5last keyintegerPosition of the last key argument, negative counts from the end
6stepintegerDistance between key arguments
7acl categoriessetCategories with a @ prefix, such as @read, @fast, @connection
8tipssetCommand tips
9key specificationssetOne map per key spec with flags, begin_search and find_keys
10subcommandsarrayEntries of the same shape for each subcommand, an empty set when none exist

A key specification map has an optional notes string, a flags set (RO, RW, OW, RM, access, update, insert, delete, not_key, incomplete, variable_flags), a begin_search map and a find_keys map. Both maps hold a type and a spec map. begin_search types are index (index), keyword (keyword, startfrom) and unknown. find_keys types are range (lastkey, keystep, limit), keynum (keynumidx, firstkey, keystep) and unknown.

  • COMMAND COUNT: Integer: number of commands that have a definition.
  • COMMAND DOCS: Map keyed by lowercase command name. Each value is a map with these keys. Empty fields are left out, group is always present.
KeyTypeDescription
summarystringOne-line description
sincestringVersion the command was added in
groupstringCommand group, for example bucket or connection
complexitystringTime complexity
doc_flagssetdeprecated or syscmd
historysetPairs of version and change description
reply_schemamapJSON Schema of the reply, see below
argumentsarrayArgument descriptions, see below
subcommandsmapSubcommands keyed as container|subcommand, same shape as above

Each argument is a map with name, type, display_text, token, flags (optional, multiple, multiple_token) and, for oneof and block types, a nested arguments array.

The reply schema is a JSON Schema document. JSON objects arrive as maps, JSON arrays as arrays, and strings, integers and booleans keep their type. On RESP2 every map becomes a flat array of alternating keys and values.

  • COMMAND LIST: Array of command names, lowercase. Subcommands are named container|subcommand.
  • COMMAND GETKEYS: Array of the key arguments, as sent.
  • COMMAND GETKEYSANDFLAGS: Array of pairs. Each pair is the key and a set of its key spec flags.
  • COMMAND HELP: Array of simple strings.

Replies come from the command definitions loaded at startup. A command without a definition is not listed and gives a null entry in COMMAND INFO. Flags and categories are written in a fixed order, not in definition order. On RESP2, sets and maps arrive as flat arrays.

COMMAND GETKEYS finds keys with the key specifications of the command. It fails when the command has no key specifications, when the argument count does not fit the command arity, or when a specification cannot be applied to the given arguments. When no key is found the result is the same. A command that has no mandatory keys gives an empty array in these two cases.

This command does not require the cluster to be initialized.

Argument errors:

Error CodeError messageCause
ERRunknown subcommand '<value>'. Try COMMAND HELP.-
ERRwrong number of arguments for 'command|<subcommand>' commandSubcommand called with the wrong argument count
ERRsyntax errorBad COMMAND LIST filter
ERRInvalid command specifiedGETKEYS with an unknown command
ERRThe command has no key argumentsGETKEYS with a command without key specs
ERRInvalid number of arguments specified for commandGETKEYS argument count does not fit the arity
ERRInvalid arguments specified for commandGETKEYS key specs do not apply to the arguments

Get documentation for PING (RESP3):

127.0.0.1:5484> COMMAND DOCS ping
1# "ping" =>
1# "summary" => "Ping the server"
2# "since" => "1.0.0"
3# "group" => "connection"
4# "complexity" => "O(1)"
5# "arguments" =>
1) 1# "name" => "message"
2# "type" => "string"
3# "display_text" => "message"
4# "flags" => ~1 "optional"

Get command count:

127.0.0.1:5484> COMMAND COUNT
(integer) 42

Get info for PING (RESP3):

127.0.0.1:5484> COMMAND INFO ping
1) 1) "ping"
2) (integer) -1
3) 1~ fast
4) (integer) 0
5) (integer) 0
6) (integer) 0
7) 1~ @fast
2~ @connection
8) 1~ "REQUEST_POLICY:ALL_SHARDS"
2~ "RESPONSE_POLICY:ALL_SUCCEEDED"
9) (empty set)
10) (empty set)

List commands by pattern:

127.0.0.1:5484> COMMAND LIST FILTERBY PATTERN bucket.*
1) "bucket.query"

Get the keys of a command:

127.0.0.1:5484> COMMAND GETKEYS set foo bar
1) "foo"

Get the keys with their flags (RESP3):

127.0.0.1:5484> COMMAND GETKEYSANDFLAGS get foo
1) 1) "foo"
2) 1~ RO
2~ access