Function: createTypedRegistry()
ts
function createTypedRegistry<TContext>(): <TBuilders>(...builders) => TypedToolRegistry<TContext, TBuilders>;Defined in: packages/core/src/client/createTypedRegistry.ts:64
Create a type-preserving tool registry.
Uses currying to separate the TContext generic (explicitly provided) from the builder tuple types (automatically inferred).
Type Parameters
| Type Parameter | Description |
|---|---|
TContext | Application context type (must be specified explicitly) |
Returns
A function that accepts builders and creates the typed registry
ts
<TBuilders>(...builders): TypedToolRegistry<TContext, TBuilders>;Type Parameters
| Type Parameter |
|---|
TBuilders extends ToolBuilder<TContext>[] |
Parameters
| Parameter | Type |
|---|---|
...builders | TBuilders |
Returns
TypedToolRegistry<TContext, TBuilders>
Example
typescript
// Step 1: Set the context type
const createRegistry = createTypedRegistry<AppContext>();
// Step 2: Register builders (types are inferred)
const registry = createRegistry(projectsTool, billingTool);
// Or as a one-liner:
const registry = createTypedRegistry<AppContext>()(projectsTool, billingTool);