data
Fauna CLI for AI Agents
Use the Fauna CLI from KosmoKrator to call Fauna tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Fauna CLI Setup
Fauna can be configured headlessly with `kosmokrator integrations:configure fauna`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure fauna --set bearer_token="$FAUNA_BEARER_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor fauna --json
kosmokrator integrations:status --json Credentials
Authentication type: API token api_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
bearer_token | FAUNA_BEARER_TOKEN | Secret secret | yes | Bearer Token |
base_url | FAUNA_BASE_URL | Text string | no | Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call fauna.fauna_list_databases '{}' --json kosmo integrations:fauna fauna_list_databases '{}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs fauna --json
kosmo integrations:docs fauna.fauna_list_databases --json
kosmo integrations:schema fauna.fauna_list_databases --json
kosmo integrations:search "Fauna" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
fauna.fauna_list_databases
List all databases in the current Fauna context. Returns database names and their metadata including creation time and references.
read - Parameters
- none
kosmo integrations:call fauna.fauna_list_databases '{}' --json kosmo integrations:fauna fauna_list_databases '{}' --json fauna.fauna_get_database
Get details of a specific Fauna database by name. Returns database metadata including name, reference, creation time, and configured options.
read - Parameters
- name
kosmo integrations:call fauna.fauna_get_database '{"name":"example_name"}' --json kosmo integrations:fauna fauna_get_database '{"name":"example_name"}' --json fauna.fauna_create_database
Create a new Fauna database. Provide a database name and optional configuration. Requires a server or admin key. Returns the created database metadata.
write - Parameters
- name, data_col, typecheck
kosmo integrations:call fauna.fauna_create_database '{"name":"example_name","data_col":"example_data_col","typecheck":true}' --json kosmo integrations:fauna fauna_create_database '{"name":"example_name","data_col":"example_data_col","typecheck":true}' --json fauna.fauna_query_fql
Execute a Fauna Query Language (FQL) expression. Provide the query as a JSON-encoded FQL expression. Supports all FQL operations including document reads, writes, indexes, and complex queries.
action - Parameters
- query
kosmo integrations:call fauna.fauna_query_fql '{"query":"example_query"}' --json kosmo integrations:fauna fauna_query_fql '{"query":"example_query"}' --json fauna.fauna_list_collections
List all collections in the current Fauna database. Returns collection names and their metadata including references and creation time.
read - Parameters
- none
kosmo integrations:call fauna.fauna_list_collections '{}' --json kosmo integrations:fauna fauna_list_collections '{}' --json fauna.fauna_get_collection
Get details of a specific Fauna collection by name. Returns collection metadata including name, reference, creation time, and configured options.
read - Parameters
- name
kosmo integrations:call fauna.fauna_get_collection '{"name":"example_name"}' --json kosmo integrations:fauna fauna_get_collection '{"name":"example_name"}' --json fauna.fauna_get_current_user
Get the current authenticated Fauna key identity. Verifies the configured bearer token and returns the associated key identity information.
read - Parameters
- none
kosmo integrations:call fauna.fauna_get_current_user '{}' --json kosmo integrations:fauna fauna_get_current_user '{}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
fauna.fauna_list_databases 0 parameters
kosmo integrations:schema fauna.fauna_list_databases --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
fauna.fauna_get_database 1 parameters
kosmo integrations:schema fauna.fauna_get_database --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Database name. |
fauna.fauna_create_database 3 parameters
kosmo integrations:schema fauna.fauna_create_database --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Database name. |
data_col | string | no | Region group for the database (e.g., "us-east-1"). |
typecheck | boolean | no | Enable typechecking for the database. |
fauna.fauna_query_fql 1 parameters
kosmo integrations:schema fauna.fauna_query_fql --json | Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | JSON-encoded FQL query expression. |
fauna.fauna_list_collections 0 parameters
kosmo integrations:schema fauna.fauna_list_collections --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
fauna.fauna_get_collection 1 parameters
kosmo integrations:schema fauna.fauna_get_collection --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Collection name. |
fauna.fauna_get_current_user 0 parameters
kosmo integrations:schema fauna.fauna_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.