Documentation
¶
Overview ¶
Package localapp speaks MCP to the HEY desktop app's own socket: the door the app opens while "Let agents use HEY" is on in its Settings. It is plain MCP, JSON-RPC 2.0 with one message per line, and the client asks only for what hey local needs: initialize, tools/list and tools/call.
What the door serves is the app's, not HEY's: it runs the app's own commands over the mail the app holds, and a command that reaches people (a send) answers pending, waiting in the app's window for the person to press Send. Nothing here can confirm one.
Index ¶
Constants ¶
const EffectMetaKey = "com.hey/effect"
EffectMetaKey is where a tool's _meta names its effect: read, reversible or reaches_people.
const MaxLine = 16 << 20
MaxLine bounds one message from the app. An Imbox listing is a few hundred kilobytes at most; a line past this is not an answer worth waiting for.
const ProtocolVersion = "2025-06-18"
ProtocolVersion is the MCP revision the client asks for. initialize, tools/list and tools/call read the same in every revision so far, so whichever one the app answers with is accepted.
const SocketEnv = "HEY_LOCAL_SOCKET"
SocketEnv overrides where the door is looked for, as --socket does for one command.
Variables ¶
var ErrNoRuntimeDir = errors.New("XDG_RUNTIME_DIR is not set to an absolute path")
ErrNoRuntimeDir is a session with no XDG_RUNTIME_DIR, the one folder the app opens its door in. The app refuses to open one without it, so there is nothing to guess at.
Functions ¶
func SocketPath ¶
SocketPath is where the door is: the flag's path, else HEY_LOCAL_SOCKET's, else $XDG_RUNTIME_DIR/hey/agent.sock, where the app opens it.
Types ¶
type Client ¶
type Client struct {
// Server is what the app said about itself in its initialize answer.
Server ServerInfo
// contains filtered or unexported fields
}
Client is one connection to the app's door, initialized and ready for calls. It sends one request at a time and reads its answer before the next.
func Dial ¶
Dial connects to the door at path and initializes the session. ctx bounds the dial and the initialize; each later call is bounded by its own.
type ConnectError ¶
ConnectError is a socket that is there but could not be used: refused by permissions, not a socket, or a connection that broke.
func (*ConnectError) Error ¶
func (e *ConnectError) Error() string
func (*ConnectError) Unwrap ¶
func (e *ConnectError) Unwrap() error
type DoorClosedError ¶
DoorClosedError is a socket that is not there, or that nothing answers on: the door is off in the app's Settings, or the app is not running.
func (*DoorClosedError) Error ¶
func (e *DoorClosedError) Error() string
func (*DoorClosedError) Unwrap ¶
func (e *DoorClosedError) Unwrap() error
type Pending ¶
type Pending struct {
Confirmation json.RawMessage `json:"confirmation,omitempty"`
Snapshot json.RawMessage `json:"snapshot,omitempty"`
}
Pending is a call the app took but did not carry out: it waits in the app's window for the person, who sees Snapshot and sends it or not.
type ProtocolError ¶
ProtocolError is an answer the client cannot read as MCP. Closed is a connection the app closed before it answered, as it does a caller of another user account.
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string
type Result ¶
type Result struct {
Content []Content `json:"content"`
StructuredContent json.RawMessage `json:"structuredContent,omitempty"`
IsError bool `json:"isError,omitempty"`
}
Result is the app's answer to a tools/call.
func (*Result) Answer ¶
func (r *Result) Answer() json.RawMessage
Answer is the result's structured answer: structuredContent, or the text content where that is JSON and there is no structuredContent. nil where the result carries neither.
type ServerError ¶
ServerError is a JSON-RPC error the app answered with: a method or a tool it does not have, or arguments it could not read.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
type ServerInfo ¶
type TimeoutError ¶
TimeoutError is an answer that did not come in time.
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
func (*TimeoutError) Unwrap ¶
func (e *TimeoutError) Unwrap() error
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema,omitempty"`
Annotations json.RawMessage `json:"annotations,omitempty"`
Meta map[string]any `json:"_meta,omitempty"`
}
Tool is one command the app offers now.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package localapptest is a fake of the HEY app's door for tests: a Unix socket that answers MCP as the door's contract does, from what a test gives it.
|
Package localapptest is a fake of the HEY app's door for tests: a Unix socket that answers MCP as the door's contract does, from what a test gives it. |