tools
Collect named client tools into a frozen, name-keyed registry.
The overload is generic over the entire map (const M) so that each tool's
precise type (FunctionToolDef<S,R>, ViewToolDef<S,C>, or
AskToolDef<S,C>) and every literal key are preserved in the
ClientToolRegistry passed to the clientTools input. This lets downstream
consumers look up individual tools without losing generic information.
import { tools } from '@threadplane/chat';Declaration · overload 1
export declare function tools<const M extends Record<string, ClientToolDef>>(map: M): Readonly<M>;Type parameters
MRecord<string, ClientToolDef>
Parameters
Returns
Readonly<M>A frozen Readonly<M> where M is the exact inferred map shape.
Examples
const move = action('Move a stop', z.object({ fromDay: z.number() }), (a) => a.fromDay);
const dayCard = view('Show a day card', z.object({ label: z.string() }), DayCardComponent);
const registry = tools({ move_stop: move, day_card: dayCard });
// registry.move_stop is FunctionToolDef<...>
// registry.day_card is ViewToolDef<...>