Gateway
Gateway protocol operator methods
Methods an operator client calls on behalf of a person: helper reads, exec approval resolution, and delivery behavior for agent runs.
Operator helper methods
commands.list(operator.read) fetches the runtime command inventory for an agent.agentIdis optional; omit it to read the default agent workspace.scopecontrols which surface the primarynametargets:textreturns the primary text command token without the leading/;nativeand the defaultbothpath return provider-aware native names when available.textAliasescarries exact slash aliases such as/modeland/m.nativeNamecarries the provider-aware native command name when one exists.provideris optional and only affects native naming plus native plugin command availability.includeArgs=falseomits serialized argument metadata from the response.
tools.catalog(operator.read) fetches the runtime tool catalog for an agent. The response includes grouped tools and provenance metadata:source:coreorpluginpluginId: plugin owner whensource="plugin"optional: whether a plugin tool is optional
tools.effective(operator.read) fetches the runtime-effective tool inventory for a session.sessionKeyis required.- The gateway derives trusted runtime context from the session server-side instead of accepting caller-supplied auth or delivery context.
- The response is a session-scoped server-derived projection of the active inventory, including core, plugin, channel, and already-discovered MCP server tools.
tools.effectiveis read-only for MCP: it may project a warm session MCP catalog through the final tool policy, but does not create MCP runtimes, connect transports, or issuetools/list. If no matching warm catalog exists, the response may include a notice such asmcp-not-yet-connected,mcp-not-yet-listed, ormcp-stale-catalog.- Effective tool entries use
source="core",source="plugin",source="channel", orsource="mcp".
tools.invoke(operator.write) invokes one available tool through the same gateway policy path as/tools/invoke.nameis required.args,sessionKey,agentId,confirm, andidempotencyKeyare optional.- If both
sessionKeyandagentIdare present, the resolved session agent must matchagentId. - Owner-only core wrappers such as
cron,gateway, andnodesrequire owner/admin identity (operator.admin) even thoughtools.invokeitself isoperator.write. - The response is an SDK-facing envelope with
ok,toolName, optionaloutput, and typederrorfields. Approval or policy refusals returnok:falsein the payload rather than bypassing the gateway tool policy pipeline.
skills.status(operator.read) fetches the visible skill inventory for an agent.agentIdis optional; omit it to read the default agent workspace.- The response includes eligibility, missing requirements, config checks, and sanitized install options without exposing raw secret values.
skills.searchandskills.detail(operator.read) return ClawHub discovery metadata.skills.upload.begin,skills.upload.chunk, andskills.upload.commit(operator.admin) stage a private skill archive before installing it. This is a separate admin upload path for trusted clients, not the normal ClawHub skill install flow, and is disabled by default unlessskills.install.allowUploadedArchivesis enabled.skills.upload.begin({ kind: "skill-archive", slug, sizeBytes, sha256?, force?, idempotencyKey? })creates an upload bound to that slug and force value.skills.upload.chunk({ uploadId, offset, dataBase64 })appends bytes at the exact decoded offset.skills.upload.commit({ uploadId, sha256? })verifies the final size and SHA-256. Commit only finalizes the upload; it does not install the skill.- Uploaded skill archives are zip archives containing a
SKILL.mdroot. The archive's internal directory name never selects the install target.
skills.install(operator.admin) has three modes:- ClawHub mode:
{ source: "clawhub", slug, version?, force? }installs a skill folder into the default agent workspaceskills/directory. - Upload mode:
{ source: "upload", uploadId, slug, force?, sha256?, timeoutMs? }installs a committed upload into the default agent workspaceskills/<slug>directory. The slug and force value must match the originalskills.upload.beginrequest. Rejected unlessskills.install.allowUploadedArchivesis enabled; the setting does not affect ClawHub installs. - Gateway installer mode:
{ name, installId, timeoutMs? }runs a declaredmetadata.openclaw.installaction on the gateway host. Older clients may still senddangerouslyForceUnsafeInstall; this field is deprecated, accepted only for protocol compatibility, and ignored. Usesecurity.installPolicyfor operator-owned install decisions.
- ClawHub mode:
skills.update(operator.admin) has two modes:- ClawHub mode updates one tracked slug or all tracked ClawHub installs in
the default agent workspace. Updates that would replace a skill directory
whose installed files no longer match the recorded install digests are
refused; the per-skill failure in
details.resultscarriescode: "force_required". Retry with the optionalforce: trueparameter to replace such a skill anyway. - Config mode patches
skills.entries.<skillKey>values such asenabled,apiKey, andenv.
- ClawHub mode updates one tracked slug or all tracked ClawHub installs in
the default agent workspace. Updates that would replace a skill directory
whose installed files no longer match the recorded install digests are
refused; the per-skill failure in
models.list views
models.list accepts an optional view parameter
(src/agents/model-catalog-visibility.ts):
- Omitted or
"default": ifagents.defaults.modelPolicy.allowis configured, the response is the allowed catalog, including dynamically discovered models forprovider/*entries. Otherwise the response is the full gateway catalog. "configured": picker-sized behavior. Ifagents.defaults.modelPolicy.allowis configured, it still wins, including provider-scoped discovery forprovider/*entries. Without an allowlist, the response uses explicitmodels.providers.<provider>.modelsentries, falling back to the full catalog only when no configured model rows exist."provider-config": source-authoredmodels.providers.*.modelsinventory, independent of picker allowlists. Rows include public model capabilities and route-aware availability, but omit provider endpoints, auth material, and runtime request configuration."all": full gateway catalog, bypassingagents.defaults.modelPolicy.allow. Use for diagnostics/discovery UIs, not normal model pickers.
Two optional controls separate automatic reads from operator-requested discovery:
preparedOnly: truereuses the current prepared catalog or a completed catalog for that runtime generation without starting provider discovery. Control UI startup and polling use this mode.refresh: truereplaces a completed full catalog when the selected view requires discovery. Concurrent refreshes share one build; a failed refresh leaves the previous completed catalog available and returns the failure to the caller.
preparedOnly: true and refresh: true are mutually exclusive because one forbids discovery
while the other requests it.
Exec approvals
- When an exec request needs approval, the gateway broadcasts
exec.approval.requested. - Operator clients resolve by calling
exec.approval.resolve(requiresoperator.approvals). - For
host=node,exec.approval.requestmust includesystemRunPlan(canonicalargv/cwd/rawCommand/session metadata). Requests missingsystemRunPlanare rejected. - After approval, forwarded
node.invoke system.runcalls reuse that canonicalsystemRunPlanas the authoritative command/cwd/session context. - If a caller mutates
command,rawCommand,cwd,agentId, orsessionKeybetween prepare and the final approvedsystem.runforward, the gateway rejects the run instead of trusting the mutated payload.
Agent delivery fallback
agentrequests can includedeliver=trueto request outbound delivery.bestEffortDeliver=false(the default) keeps strict behavior: unresolved or internal-only delivery targets returnINVALID_REQUEST.bestEffortDeliver=trueallows fallback to session-only execution when no external deliverable route can be resolved (for example internal/webchat sessions or ambiguous multi-channel configs).- Final
agentresults may includeresult.deliveryStatuswhen delivery was requested, using the samesent,suppressed,partial_failed, andfailedstatuses documented foropenclaw agent --json --deliver.
Was this useful?