@threadplane/chatInterfacev0.3.4

ClientToolsCapability

Optional Agent capability that lets the client declare tools to the model and return their results. Implemented per-transport by each adapter (AG-UI: native RunAgentInput.tools + addMessage/re-run; LangGraph: catalog via run input + ToolMessage re-run).

import type { ClientToolsCapability } from '@threadplane/chat';

Declaration

export interface ClientToolsCapability  {
  flush?(): void | Promise<void>;
  readonly pending: Signal<readonly ToolCall[]>;
  resolve(toolCallId: string, result: ClientToolResult): void;
  setCatalog(specs: readonly ClientToolSpec[]): void;
  settle?(toolCallId: string, result: ClientToolResult): void;
}

Members

flush · overload 1

Make every result recorded via settle durable on the server WITHOUT continuing the run. No-op for adapters whose settle() is already durable. Adapters that buffer locally MUST clear their buffer only on a successful write, so a failure degrades to a later flush or submit.

flush?(): void | Promise<void>;

Returns

void | Promise<void>

pending

Tool calls the model made for client tools that await a client result.

readonly pending: Signal<readonly ToolCall[]>;

resolve · overload 1

Return a client tool's result (or error) and continue the run.

resolve(toolCallId: string, result: ClientToolResult): void;

Parameters

toolCallId · required
string
result · required
ClientToolResult

Returns

void

setCatalog · overload 1

Ship the client tool catalog to the model at run start.

setCatalog(specs: readonly ClientToolSpec[]): void;

Parameters

specs · required
readonly ClientToolSpec[]

Returns

void

settle · overload 1

Record a client tool's result without continuing the run.

settle?(toolCallId: string, result: ClientToolResult): void;

Parameters

toolCallId · required
string
result · required
ClientToolResult

Returns

void