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· requiredstringresult· requiredClientToolResult
Returns
voidsetCatalog · overload 1
Ship the client tool catalog to the model at run start.
setCatalog(specs: readonly ClientToolSpec[]): void;Parameters
specs· requiredreadonly ClientToolSpec[]
Returns
voidsettle · overload 1
Record a client tool's result without continuing the run.
settle?(toolCallId: string, result: ClientToolResult): void;Parameters
toolCallId· requiredstringresult· requiredClientToolResult
Returns
void