@threadplane/chatFunctionv0.3.4

view

Render-only component tool — the model fills the component's props from the schema's output; the tool call is auto-acknowledged once the component mounts.

The component's signal inputs are checked against the schema output type (strict-but-flexible: every schema key must be a declared input with an assignable type; the component may declare extra inputs the schema doesn't fill). Author the component with ViewProps<typeof schema> as the input type set to guarantee the shapes stay aligned.

import { view } from '@threadplane/chat';

Declaration · overload 1

export declare function view<S extends StandardSchemaV1, C>(description: string, schema: S, component: AcceptComponent<S, C>, options?: ClientToolContinuationOptions): ViewToolDef<S, C>;

Type parameters

C

Parameters

description · required
string

Natural-language description the model sees.

schema · required
S

Standard Schema defining the props the model must supply.

component · required
AcceptComponent<S, C>

Angular component whose signal inputs must be compatible with the schema output. A type-level error is reported here when they diverge.

Returns

ViewToolDef<S, C>

A ViewToolDef for inclusion in tools.

Examples

const schema = z.object({ label: z.string(), day: z.number() });
type Inputs = ViewProps<typeof schema>; // { label: string; day: number }

\@Component({ ... })
class DayCardComponent {
  label = input.required<string>();
  day   = input.required<number>();
}

const dayCard = view('Show a day card', schema, DayCardComponent);
const registry = tools({ day_card: dayCard });