Guides
Actions#
Actions are deliberate user-invoked commands exposed through agent-connector's runtime. They are useful when a human wants a button/menu/command affordance, but the operation is not a model-selected MCP tool and not a lifecycle hook.
Actions vs tools vs hooks#
MCP tools are for the model. Hooks are for host lifecycle events. Actions are for a human deliberately invoking a connector command from a CLI, palette, button, menu, or generated host command where the target host has an affordance.
| Surface | Who starts it? | Use it for |
|---|---|---|
MCP tool | The model requests it through the host. | Capabilities the model may need while answering. |
Hook | The host emits a lifecycle event. | Policy, context, telemetry, and host-side decisions around events. |
Action | The user invokes an affordance. | Intentional commands such as refresh, open report, repair install, clear cache, or run a package-specific workflow. |
Always keep a CLI fallback#
The universal form is agent-connector action <host> <id>. Host-native buttons and commands can call the same entrypoint, but a documented CLI path makes support and automation possible on every host.
# Same action through the universal fallback entrypoint
agent-connector action warp refresh-index --connector acme-db
agent-connector action hermes open-dashboard --connector acme-db
# Prefer this fallback in docs and support runbooks.
# Host-native buttons/commands can call the same entrypoint where wired.The dispatch flow#
User invokes a host action
|
v
Host affordance calls the agent-connector action entrypoint
|
v
Runtime resolves connector + action id
|
v
action.run(ctx) executes deliberate user command
|
v
Result is returned to the host affordanceThe important beginner distinction is authority: an action is a human command, so its UX should make the operation obvious before it runs. If the model should decide when to call something, it belongs in MCP tools.
Define an action in a connector#
An action has a kebab-case id and a run(ctx) handler. Add label, icon, placement, and confirm when the host affordance can display them. Use hosts only when one host needs different user-facing metadata or execution path; the top-level handler remains the fallback.
import { defineAction, defineConnector } from "@ken-jo/agent-connector/sdk";
const refreshIndex = defineAction({
id: "refresh-index",
label: "Refresh schema index",
description: "Refresh the local schema index.",
icon: "refresh-cw",
placement: "command-palette",
confirm: {
title: "Refresh schema index",
message: "Rebuild the local acme-db schema index now?",
},
async run(ctx) {
await refreshLocalSchemaIndex(ctx.projectDir);
return { message: `Refreshed acme-db index for ${ctx.host}` };
},
hosts: {
warp: {
label: "Refresh acme-db",
description: "Refresh the schema index for this Warp workspace.",
placement: "workflow",
confirm: false,
async run(ctx) {
await refreshLocalSchemaIndex(ctx.projectDir);
return { message: "Warp workspace index refreshed." };
},
},
},
});
export default defineConnector({
server: { transport: "stdio", command: "node", args: ["./my-mcp-server.mjs"] },
actions: [refreshIndex],
});How host affordances map#
Host documentation usually describes commands, plugins, menus, workflows, or MCP registration separately. agent-connector treats actions as a connector-level runtime surface and lets adapters bind that runtime to a native affordance only where the host has a verified place to do so.
| Case | What the user sees | Recommended connector behavior |
|---|---|---|
| Native affordance exists | A generated command, palette item, menu item, or plugin command. | Bind the affordance to agent-connector action and return a concise message. |
| Different host shape | A workflow, task, plugin command, slash command, hook panel, or paste-based command. | Inspect actionInvocationMode and actionAffordanceKind; override only the metadata that host needs. |
| MCP-only host | The host can call MCP tools but has no separate action UI. | Keep the MCP server installed, skip action affordances, and publish the CLI fallback. |
| Plugin host | A host plugin can register lifecycle or command handlers, as in the OpenCode plugin model. | Let the adapter generate glue and keep package logic inside defineAction. |
Cross-validation for action hosts#
An action host is listed only when its adapter sets supportsActions and implements a concrete host affordance emitter, not merely because the universal agent-connector action CLI exists. The fallback CLI works everywhere, but the supported-host list is only for hosts with generated native affordances.
| Host | Adapter proof | Reference / test proof |
|---|---|---|
| Warp | supportsActions + owned workflow YAML | Warp workflows docs + tests/adapters/warp.test.ts |
| Droid (Factory) | supportsActions + owned executable command file | adapter implementation + tests/adapters/droid.test.ts |
| Zed | supportsActions + .zed/tasks.json task entry | Zed tasks docs + tests/adapters/zed.test.ts |
| Pi | supportsActions + registerCommand-style action bridge | adapter implementation + tests/adapters/pi.test.ts |
| Kiro | supportsActions + manual hook-panel action emitter | adapter implementation + tests/adapters/kiro.test.ts |
| Hermes Agent | supportsActions + Hermes native command bridge | adapter implementation + tests/adapters/hermes.test.ts |
| Oh My Pi (OMP) | supportsActions + registerCommand plugin surface | adapter implementation + tests/adapters/omp.test.ts |
| NVIDIA NemoClaw | inherits OpenClaw action bridge | inherited adapter implementation + tests/adapters/nemoclaw.test.ts |
| OpenClaw | supportsActions + registerCommand plugin surface | adapter implementation + tests/adapters/openclaw.test.ts |
Where host affordances are wired today#
Public coverage metadata currently marks action affordance support in 9 / 42 production-relevant adapters:
Warp, Droid (Factory), Zed, Pi, Kiro, Hermes Agent, Oh My Pi (OMP), NVIDIA NemoClaw, OpenClaw
Customization checklist#
- Name the id as a command, not a noun:
refresh-index,open-dashboard,repair-install. - Keep the operation user-triggered. If the model should choose when to run it, expose it as an MCP tool instead.
- Use per-host
hosts.<id>.runoverrides for UI text, platform-specific paths, or affordance-specific behavior. - Return a short
message. Actions surface errors to the user; they do not fail silently like statusline rendering.
Design rules for beginners#
- Name actions like UI commands:
refresh-index,open-dashboard,repair-install. - Keep action output concise and user-facing. It is not a tool result optimized for model reasoning.
- Do not hide dangerous writes behind vague labels. Use confirmations or dry-run previews where the host affordance supports them.
- Provide a CLI fallback path for important operations because not every host exposes action affordances yet.