Use the Dgraph CLI from KosmoKrator to call Dgraph tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.
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 --jsonkosmokrator integrations:doctor dgraph --jsonkosmokrator integrations:status --json
Credentials
Authentication type: API tokenapi_token. Configure credentials once, then use the same stored profile from
scripts, coding CLIs, Lua code mode, and the MCP gateway.
Key
Env var
Type
Required
Label
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.
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.
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.
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.).
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.
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.
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.
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.
Get the current authenticated Dgraph user identity. Verifies the configured
bearer token and returns the associated user information including ID,
name, and email.
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.
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.).
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.
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.
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.
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.
Get the current authenticated Dgraph user identity. Verifies the configured
bearer token and returns the associated user information including ID,
name, and email.
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.