Class: Toolkit<TContext>
Defined in: packages/kernl/src/tool/toolkit.ts:85
A toolkit containing static function tools.
Example
const fs = new FunctionToolkit({
id: "fs",
tools: [readFile, writeFile, listDir, ...]
});Extends
BaseToolkit<TContext>
Type Parameters
| Type Parameter | Default type |
|---|---|
TContext | UnknownContext |
Constructors
Constructor
new Toolkit<TContext>(config: FunctionToolkitConfig<TContext>): FunctionToolkit<TContext>;Defined in: packages/kernl/src/tool/toolkit.ts:97
Create a new function toolkit.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | FunctionToolkitConfig<TContext> | Toolkit configuration with id and tools array |
Returns
FunctionToolkit<TContext>
Overrides
BaseToolkit<TContext>.constructorProperties
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|
agent? | protected | BaseAgent<any, "text"> | The agent this toolkit is bound to (if any). Uses any to allow toolkits with different context types to be composed in the same agent. | - | BaseToolkit.agent | packages/kernl/src/tool/toolkit.ts:37 |
description | readonly | string | Description of what this toolkit provides | BaseToolkit.description | - | packages/kernl/src/tool/toolkit.ts:89 |
id | readonly | string | Unique identifier for this toolkit | BaseToolkit.id | - | packages/kernl/src/tool/toolkit.ts:88 |
Methods
bind()
bind(agent: BaseAgent<any>): void;Defined in: packages/kernl/src/tool/toolkit.ts:43
Bind this toolkit to an agent. Called by agent constructor.
Parameters
| Parameter | Type |
|---|---|
agent | BaseAgent<any> |
Returns
void
Inherited from
BaseToolkit.binddestroy()
destroy(): Promise<void>;Defined in: packages/kernl/src/tool/toolkit.ts:69
Cleanup resources held by this toolkit. Override if your toolkit needs cleanup (e.g., closing connections). Default implementation does nothing.
Returns
Promise<void>
Inherited from
BaseToolkit.destroyget()
get(id: string): Tool<TContext> | undefined;Defined in: packages/kernl/src/tool/toolkit.ts:110
Get a specific tool by ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The tool ID to look up |
Returns
Tool<TContext> | undefined
The tool if found, undefined otherwise
Overrides
BaseToolkit.getlist()
list(context?: Context<TContext>): Promise<Tool<TContext>[]>;Defined in: packages/kernl/src/tool/toolkit.ts:120
List all tools in this toolkit.
Parameters
| Parameter | Type | Description |
|---|---|---|
context? | Context<TContext> | Optional context for filtering tools (currently unused) |
Returns
Promise<Tool<TContext>[]>
Array of all tools in this toolkit
Overrides
BaseToolkit.list