PreviewTool
SUPPORT · interface · Type contract
A model tool with an explicit, presentation-only streaming preview contract.
Import
ts
import type { PreviewTool } from '@jangts/agent-core/support';js
/** @typedef {import('@jangts/agent-core/support').PreviewTool} PreviewTool */Other public entry points:@jangts/agent-core/support, @jangts/agent-core/support/model.
Definition
ts
interface PreviewTool<Input, Selection, Context>Extends or implements: ModelTool< Input, Selection, Context >.
Type parameters
| Type parameter | Constraint | Default type |
|---|---|---|
Input | — | unknown |
Selection | — | Input |
Context | — | any |
Field structure
| Field | Type | Required | Description |
|---|---|---|---|
preview | true | Omit<ReplyPreviewRule, "stageId" | "toolId"> | undefined | Optional | Read-only. See the type definition and usage context. |
id | string | Required | Read-only. Unique id within its registry; never blank. |
description | string | Required | Read-only. Model-visible description explaining when the capability applies. |
inputSchema | SchemaAdapter<Input> | Required | Read-only. Schema describing the arguments; must be an object schema. |
active | ToolCondition<Context> | undefined | Optional | Read-only. Omitted means active. Authorization remains a separate execution boundary. |
asIntent | AsIntent<Context> | undefined | Optional | Read-only. Omitted means this tool is not advertised by withIntent(). |
resolve | (input: Input, context: Readonly<{ stageId: string; }>) => Selection | Required | Converts validated arguments into the value handed back to the caller. Runs inside the model call, so it must return synchronously; throwing rejects the selection. |
Member index
| Member | Purpose |
|---|---|
resolve | Converts validated arguments into the value handed back to the caller. Runs inside the model call, so it must return synchronously; throwing rejects the selection. |
Member details
resolve
Converts validated arguments into the value handed back to the caller.
Runs inside the model call, so it must return synchronously; throwing rejects the selection.
ts
PreviewTool.resolve(input: Input, context: Readonly<{ stageId: string; }>): SelectionConverts validated arguments into the value handed back to the caller.
Runs inside the model call, so it must return synchronously; throwing rejects the selection.
| Parameter | Type | Passing | Description |
|---|---|---|---|
input | Input | Required | — |
context | Readonly<{ stageId: string; }> | Required | — |
Fields of context
| Field | Type | Required | Description |
|---|---|---|---|
stageId | string | Required | See the type definition and usage context. |
Returns: Selection.
Awaited value: Awaited<Selection>.
Using the type
When using this type, choose type arguments from the table above; parameters with defaults may be omitted.