Opencode

View as Markdown

Drop the Dial skill into your Opencode config so the terminal agent learns how to drive the dial CLI on demand. Once installed, Opencode can send messages, place calls, and wait for events without you re-explaining the surface.

Install

Two ways to give Opencode Dial: drop in the CLI skill (Opencode drives the dial CLI), or wire up the MCP server (Opencode calls Dial’s tools directly). Pick whichever fits — they’re not mutually exclusive.

First, get the dial CLI on your PATH:

$curl -fsSL https://getdial.ai/install | bash

Then drop the Opencode-specific Dial skill into your config:

$dial onboard --code <code> --agent opencode

onboard finishes verification first, then copies the Dial skill into Opencode’s standard config directory. Re-run the command anytime (after a CLI upgrade, for example) to overwrite the skill in place — the verification step is a no-op once you’re onboarded.

A single markdown skill describing the dial CLI — its commands, flags, and conventions, mirroring the CLI reference — gets installed. Opencode loads the skill when a Dial-related task comes up; nothing else is touched.

Option 2 — MCP server

Run Dial as a native MCP server and Opencode calls its tools directly. Opencode has no CLI command to add a server — MCP servers are configured in your opencode.json under the mcp key, so add the entry there. Use the local transport (npx -y @getdial/cli mcp, which reuses your saved CLI key) or the remote transport (https://getdial.ai/mcp, which Opencode authenticates via browser OAuth on first use):

1# opencode.json (project) or ~/.config/opencode/opencode.json (global)
2{
3 "$schema": "https://opencode.ai/config.json",
4 "mcp": {
5 "dial": {
6 "type": "local",
7 "command": ["npx", "-y", "@getdial/cli", "mcp"],
8 "enabled": true
9 }
10 }
11}

See the MCP page for the full tool list and the remote OAuth flow, and Opencode’s own MCP servers docs for the config schema.

Use it

Both paths work the same way: just ask in plain language.

Send an SMS to +14155550123 with the body “running late, ETA 10 min”.

With the CLI skill, Opencode picks up the skill and runs the right dial command; with the MCP server, it calls Dial’s tools directly — no CLI shell-out. See Using Dial from an agent for more examples.

Inbound event handling (Suggestion)

You can also wake Opencode automatically when a Dial event arrives by wiring a CLI command target: for each inbound event, the listen daemon spawns a handler that delivers a fresh prompt to Opencode’s non-interactive mode.

First install the listen daemon:

$dial listen install

1. Write a handler

$#!/usr/bin/env bash
$# /usr/local/bin/handle-dial-event-opencode
$event="$1"
$
$type=$(jq -r '.type' <<<"$event")
$from=$(jq -r '.from // ""' <<<"$event")
$body=$(jq -r '.body // ""' <<<"$event")
$
$prompt=$(cat <<EOF
>A Dial event just arrived. Decide what to do and act on it.
>
> type: $type
> from: $from
> body: $body
>
>raw event JSON:
>$event
>EOF
>)
$
$# Detach a fresh Opencode run and return right away.
$nohup opencode run -q "$prompt" </dev/null >>~/.dial/opencode.log 2>&1 &
$disown
$exit 0

opencode run is Opencode’s non-interactive mode (alternatively opencode -p "$prompt"). -q (alias --quiet) suppresses the spinner, which is the right shape for unattended scripts.

2. Register

$chmod +x /usr/local/bin/handle-dial-event-opencode
$dial local-target add cmd /usr/local/bin/handle-dial-event-opencode

The nohup … & disown pattern keeps Opencode running after the handler exits, so a multi-minute agent run never collides with the daemon’s per-attempt --timeout. See CLI command target for the full reference, delivery semantics, and the once-retry behavior.