data
Directus CLI for Headless Automation
Use the Directus CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 4 read 3 write Bearer token auth
Directus CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The Directus CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Directus CLI for Headless Automation
kosmokrator integrations:configure directus --set access_token="$DIRECTUS_ACCESS_TOKEN" --set url="$DIRECTUS_URL" --enable --read allow --write ask --json
kosmo integrations:call directus.directus_list_items '{"collection":"example_collection","limit":1,"offset":1,"sort":"example_sort","filter":"example_filter","fields":"example_fields","search":"example_search","page":1}' --json Discovery Before Execution
Agents and scripts can inspect Directus docs and schemas before choosing a function.
kosmo integrations:docs directus --json
kosmo integrations:docs directus.directus_list_items --json
kosmo integrations:schema directus.directus_list_items --json
kosmo integrations:search "Directus" --json
kosmo integrations:list --json Useful Directus CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
directus.directus_list_items | Read | collection, limit, offset, sort, filter, fields, search, page, meta | List items in a Directus collection with optional filtering, sorting, and pagination. Returns an array of items from the specified collection. |
directus.directus_get_item | Read | collection, id, fields | Retrieve a single item from a Directus collection by its primary key ID. |
directus.directus_create_item | Write | collection, data | Create a new item in a Directus collection with the provided field values. |
directus.directus_update_item | Write | collection, id, data | Update an existing item in a Directus collection by its primary key ID. |
directus.directus_delete_item | Write | collection, id | Delete an item from a Directus collection by its primary key ID. This action cannot be undone. |
directus.directus_list_collections | Read | none | List all available collections (tables) in the Directus instance. Returns collection names and metadata. |
directus.directus_get_current_user | Read | fields | Get the profile of the currently authenticated Directus user. Useful for verifying the connection and understanding user permissions. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.