KosmoKrator

data

Dgraph CLI for AI Agents

Use the Dgraph CLI from KosmoKrator to call Dgraph tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

9 functions 6 read 2 write API token auth

Dgraph CLI Setup

Dgraph can be configured headlessly with `kosmokrator integrations:configure dgraph`.

# 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 dgraph --set bearer_token="$DGRAPH_BEARER_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor dgraph --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
bearer_token DGRAPH_BEARER_TOKEN Secret secret yes Bearer Token
base_url DGRAPH_BASE_URL Text string no GraphQL Endpoint URL

Call Dgraph Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call dgraph.dgraph_list_schema '{}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:dgraph dgraph_list_schema '{}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs dgraph --json
kosmo integrations:docs dgraph.dgraph_list_schema --json
kosmo integrations:schema dgraph.dgraph_list_schema --json
kosmo integrations:search "Dgraph" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Dgraph.

dgraph.dgraph_list_schema

Read read

List the full GraphQL schema from Dgraph. Returns all types, their fields, and field types. Useful for understanding the overall data model.

Parameters
none

Generic CLI call

kosmo integrations:call dgraph.dgraph_list_schema '{}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_list_schema '{}' --json

dgraph.dgraph_get_schema

Read read

Get the GraphQL schema for a specific type in Dgraph. Returns the type definition including all fields and their types. Provide the type name to inspect.

Parameters
type_name

Generic CLI call

kosmo integrations:call dgraph.dgraph_get_schema '{"type_name":"example_type_name"}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_get_schema '{"type_name":"example_type_name"}' --json

dgraph.dgraph_list_types

Read read

List all types defined in the Dgraph GraphQL schema. Returns type names for all user-defined and system types available in the database.

Parameters
none

Generic CLI call

kosmo integrations:call dgraph.dgraph_list_types '{}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_list_types '{}' --json

dgraph.dgraph_list_indexes

Read read

List all indexes defined in the Dgraph schema. Returns types with their fields and directives, allowing you to identify indexed fields and their index types (hash, exact, term, fulltext, trigram, etc.).

Parameters
none

Generic CLI call

kosmo integrations:call dgraph.dgraph_list_indexes '{}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_list_indexes '{}' --json

dgraph.dgraph_get_node

Read read

Get a specific node from Dgraph by providing its type and ID. Returns the node data including all populated fields. Use the type name as defined in your GraphQL schema.

Parameters
type, id

Generic CLI call

kosmo integrations:call dgraph.dgraph_get_node '{"type":"example_type","id":"example_id"}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_get_node '{"type":"example_type","id":"example_id"}' --json

dgraph.dgraph_mutate

Write write

Execute a GraphQL mutation to add or update data in Dgraph. Provide the full GraphQL mutation string and optional variables. Supports all mutation operations including add, update, and upsert.

Parameters
mutation, variables

Generic CLI call

kosmo integrations:call dgraph.dgraph_mutate '{"mutation":"example_mutation","variables":"example_variables"}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_mutate '{"mutation":"example_mutation","variables":"example_variables"}' --json

dgraph.dgraph_drop_mutation

Write write

Execute a GraphQL drop/delete mutation to remove data from Dgraph. Provide the full GraphQL mutation string for deleting nodes and optional variables. Use with caution as this permanently removes data.

Parameters
mutation, variables

Generic CLI call

kosmo integrations:call dgraph.dgraph_drop_mutation '{"mutation":"example_mutation","variables":"example_variables"}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_drop_mutation '{"mutation":"example_mutation","variables":"example_variables"}' --json

dgraph.dgraph_query

action action

Execute a custom GraphQL query against Dgraph. Provide the full GraphQL query string and optional variables. Supports all query operations including filtering, pagination, sorting, and nested traversals.

Parameters
query, variables

Generic CLI call

kosmo integrations:call dgraph.dgraph_query '{"query":"example_query","variables":"example_variables"}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_query '{"query":"example_query","variables":"example_variables"}' --json

dgraph.dgraph_get_current_user

Read read

Get the current authenticated Dgraph user identity. Verifies the configured bearer token and returns the associated user information including ID, name, and email.

Parameters
none

Generic CLI call

kosmo integrations:call dgraph.dgraph_get_current_user '{}' --json

Provider shortcut

kosmo integrations:dgraph dgraph_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

dgraph.dgraph_list_schema

List the full GraphQL schema from Dgraph. Returns all types, their fields, and field types. Useful for understanding the overall data model.

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_list_schema --json
ParameterTypeRequiredDescription
No parameters.

dgraph.dgraph_get_schema

Get the GraphQL schema for a specific type in Dgraph. Returns the type definition including all fields and their types. Provide the type name to inspect.

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_get_schema --json
ParameterTypeRequiredDescription
type_name string yes The GraphQL type name to retrieve the schema for.

dgraph.dgraph_list_types

List all types defined in the Dgraph GraphQL schema. Returns type names for all user-defined and system types available in the database.

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_list_types --json
ParameterTypeRequiredDescription
No parameters.

dgraph.dgraph_list_indexes

List all indexes defined in the Dgraph schema. Returns types with their fields and directives, allowing you to identify indexed fields and their index types (hash, exact, term, fulltext, trigram, etc.).

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_list_indexes --json
ParameterTypeRequiredDescription
No parameters.

dgraph.dgraph_get_node

Get a specific node from Dgraph by providing its type and ID. Returns the node data including all populated fields. Use the type name as defined in your GraphQL schema.

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_get_node --json
ParameterTypeRequiredDescription
type string yes The GraphQL type of the node (e.g., "User", "Post").
id string yes The unique ID of the node to retrieve.

dgraph.dgraph_mutate

Execute a GraphQL mutation to add or update data in Dgraph. Provide the full GraphQL mutation string and optional variables. Supports all mutation operations including add, update, and upsert.

Operation
Write write
Schema command
kosmo integrations:schema dgraph.dgraph_mutate --json
ParameterTypeRequiredDescription
mutation string yes The GraphQL mutation string to execute.
variables object no Optional variables object for the mutation.

dgraph.dgraph_drop_mutation

Execute a GraphQL drop/delete mutation to remove data from Dgraph. Provide the full GraphQL mutation string for deleting nodes and optional variables. Use with caution as this permanently removes data.

Operation
Write write
Schema command
kosmo integrations:schema dgraph.dgraph_drop_mutation --json
ParameterTypeRequiredDescription
mutation string yes The GraphQL drop/delete mutation string to execute.
variables object no Optional variables object for the mutation.

dgraph.dgraph_query

Execute a custom GraphQL query against Dgraph. Provide the full GraphQL query string and optional variables. Supports all query operations including filtering, pagination, sorting, and nested traversals.

Operation
action action
Schema command
kosmo integrations:schema dgraph.dgraph_query --json
ParameterTypeRequiredDescription
query string yes The GraphQL query string to execute.
variables object no Optional variables object for the query.

dgraph.dgraph_get_current_user

Get the current authenticated Dgraph user identity. Verifies the configured bearer token and returns the associated user information including ID, name, and email.

Operation
Read read
Schema command
kosmo integrations:schema dgraph.dgraph_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.