# FUNCTION LIST

> List the loaded function libraries and their functions.

URL: https://docs.hotkv.com/commands/function-list/

```
FUNCTION LIST [LIBRARYNAME library-name-pattern] [WITHCODE]
```

- Group: Scripting and functions
- Complexity: O(N) where N is the number of functions
- HotKV Cloud: all plans
- On-Premise: no license needed

`FUNCTION LIST` describes every loaded library: its name, engine, and each
function with its description and flags.

## Options

| Option | Effect |
| --- | --- |
| `LIBRARYNAME library-name-pattern` | List only libraries whose names match this glob pattern. |
| `WITHCODE` | Include each library's source code. |

Each option may be given once.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Array with one entry per library, each a flat array of field, value pairs | Array of maps |

Each library has the fields `library_name`, `engine` (`LUA`), `functions` and,
with `WITHCODE`, `library_code`. Each function has `name`, `description`
(nil when none was given) and `flags` (an array in RESP2, a set in RESP3).

Errors:

- `ERR library name argument was not given` when `LIBRARYNAME` has no value.
- `ERR Unknown argument <argument>` for any other argument, or an option given
  twice.

## Examples

```
127.0.0.1:6379> FUNCTION LOAD "#!lua name=util\nredis.register_function('echo', function(keys, args) return args[1] end)"
"util"
127.0.0.1:6379> FUNCTION LIST LIBRARYNAME ut*
1) 1) "library_name"
   2) "util"
   3) "engine"
   4) "LUA"
   5) "functions"
   6) 1) 1) "name"
         2) "echo"
         3) "description"
         4) (nil)
         5) "flags"
         6) (empty array)
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[FUNCTION LOAD](https://docs.hotkv.com/commands/function-load/index.md), [FUNCTION STATS](https://docs.hotkv.com/commands/function-stats/index.md),
[FCALL](https://docs.hotkv.com/commands/fcall/index.md)