KosmoKrator

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, configure, and verify
# 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.

KeyEnv varTypeRequiredLabel
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.

Generic CLI call
kosmo integrations:call fauna.fauna_list_databases '{}' --json
Provider shortcut
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.

Discovery commands
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 read
Parameters
none
Generic call
kosmo integrations:call fauna.fauna_list_databases '{}' --json
Shortcut
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 read
Parameters
name
Generic call
kosmo integrations:call fauna.fauna_get_database '{"name":"example_name"}' --json
Shortcut
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 write
Parameters
name, data_col, typecheck
Generic call
kosmo integrations:call fauna.fauna_create_database '{"name":"example_name","data_col":"example_data_col","typecheck":true}' --json
Shortcut
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 action
Parameters
query
Generic call
kosmo integrations:call fauna.fauna_query_fql '{"query":"example_query"}' --json
Shortcut
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 read
Parameters
none
Generic call
kosmo integrations:call fauna.fauna_list_collections '{}' --json
Shortcut
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 read
Parameters
name
Generic call
kosmo integrations:call fauna.fauna_get_collection '{"name":"example_name"}' --json
Shortcut
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 read
Parameters
none
Generic call
kosmo integrations:call fauna.fauna_get_current_user '{}' --json
Shortcut
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
Schema command
kosmo integrations:schema fauna.fauna_list_databases --json
ParameterTypeRequiredDescription
No parameters.
fauna.fauna_get_database 1 parameters
Schema command
kosmo integrations:schema fauna.fauna_get_database --json
ParameterTypeRequiredDescription
name string yes Database name.
fauna.fauna_create_database 3 parameters
Schema command
kosmo integrations:schema fauna.fauna_create_database --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema fauna.fauna_query_fql --json
ParameterTypeRequiredDescription
query string yes JSON-encoded FQL query expression.
fauna.fauna_list_collections 0 parameters
Schema command
kosmo integrations:schema fauna.fauna_list_collections --json
ParameterTypeRequiredDescription
No parameters.
fauna.fauna_get_collection 1 parameters
Schema command
kosmo integrations:schema fauna.fauna_get_collection --json
ParameterTypeRequiredDescription
name string yes Collection name.
fauna.fauna_get_current_user 0 parameters
Schema command
kosmo integrations:schema fauna.fauna_get_current_user --json
ParameterTypeRequiredDescription
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.