Status: v1, since 2026-07-12 Audience: authors of dtctl exec plugins.
dtctl follows the kubectl exec-plugin convention and nothing heavier: an
executable named dtctl-<name> on PATH runs as dtctl <name>. There is no
installer, no registry, no RPC — deliberately.
- On an unknown top-level command, dtctl searches
PATHfor the longest dash-joined match:dtctl foo bar baztriesdtctl-foo-bar-baz, thendtctl-foo-bar(argbaz), thendtctl-foo(argsbar baz). - The plugin is exec'd (process replacement on Unix; child process with
verbatim exit-code propagation on Windows, where
.exe/.bat/.cmdare recognized). Remaining arguments pass through untouched. - Built-in commands always win. A plugin can never shadow or override a
built-in dtctl command;
dtctl plugin listwarns when a plugin name collides. - Leading dtctl flags (
dtctl --context prod foo) are consumed by dtctl and reflected into the environment contract below — they are not passed to the plugin. - Dispatch is a gated host ability. It runs only when
Capabilities.PluginDispatchis granted: the CLI binary grants it, embedded and service invocations do not. Without the grant there is noPATHlookup at all — an unknown command falls through to the normal suggestion-enhanced unknown-command error.pluginitself is one of the top-level commands removed from the service surface (SERVICE_ENGINE_DESIGN.md).
dtctl sets these variables for the plugin process:
| Variable | Meaning |
|---|---|
DTCTL_CONTEXT |
Context-name override (reflects --context when given; otherwise inherited from the caller's environment, where it has the same meaning) |
DTCTL_CONFIG |
Config file path in effect (explicit --config, discovered .dtctl.yaml, or the default global path) |
DTCTL_AGENT=1 |
Agent mode is active — emit the structured JSON envelope |
DTCTL_PLAIN=1 |
Plain mode — no colors, no interactive prompts |
DTCTL_CALLER_VERSION |
The dispatching dtctl's version, for compatibility decisions |
No tokens from dtctl. dtctl never passes credentials via argv, and it
strips its documented credential variables (DTCTL_TOKEN, DT_API_TOKEN,
DTCTL_ACCOUNT_TOKEN) from the plugin's environment. The rest of the caller's environment is
inherited as-is — a token you placed in a custom variable (e.g. one referenced
via ${MY_TOKEN} in the config file) is not recognized as a credential and
reaches the plugin like any other inherited variable. Plugins resolve
credentials themselves via the shared config contract
(CONFIG_CONTRACT.md): the config file named by
DTCTL_CONFIG and the OS keyring service dtctl. The dtctl sdk
(github.com/Dynatrace/dtctl/sdk) is the supported way to do this.
- Flags: support
-o jsonfor machine-readable output and honorDTCTL_PLAIN/--plain(no colors, no prompts). RespectNO_COLOR. - Agent envelope: when
DTCTL_AGENT=1, wrap output in the dtctl envelope —{"ok": true, "result": ...}on success,{"ok": false, "error": {"code": "...", "message": "..."}}on failure — on stdout. AI agents are dtctl's primary persona; a plugin that ignores this is invisible garbage to them. - Safety levels: the context's
safety-levelis a promise to the user that dtctl cannot enforce inside your process. Check it before mutating anything (the sdk exports the safety semantics); a plugin that writes through areadonlycontext is broken. - Exit codes: 0 success, non-zero failure. Exit codes propagate to the caller verbatim.
- Secrets hygiene: never print tokens; never accept them via argv.
- macOS keychain: each distinct binary gets its own keychain-access prompt on first credential read. Expected — tell your users once.
dtctl plugin listshows everydtctl-*executable on PATH with its binary and path — the first stop when triaging "is this a dtctl bug or a plugin bug".dtctl commands --brief -o json(the agent bootstrap catalog) includes discovered plugins underplugins, so agents can see them.
No plugin installer, no registry, no scaffolding, no Go plugin package, no
gRPC. If real third-party plugins appear (rule of thumb: ≥5), revisit.