Class: MCPToolkit<TContext>
Defined in: packages/kernl/src/tool/toolkit.ts:161
Extends
BaseToolkit<TContext>
Type Parameters
| Type Parameter | Default type |
|---|---|
TContext | UnknownContext |
Constructors
Constructor
new MCPToolkit<TContext>(config: MCPToolkitConfig<TContext>): MCPToolkit<TContext>;Defined in: packages/kernl/src/tool/toolkit.ts:178
Create a new MCP toolkit.
Parameters
| Parameter | Type | Description |
|---|---|---|
config | MCPToolkitConfig<TContext> | Toolkit configuration with id and server instance |
Returns
MCPToolkit<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:165 |
id | readonly | string | Unique identifier for this toolkit | BaseToolkit.id | - | packages/kernl/src/tool/toolkit.ts:164 |
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:245
Cleanup resources and close the MCP server connection.
Returns
Promise<void>
Overrides
BaseToolkit.destroyget()
get(id: string): Tool<TContext> | undefined;Defined in: packages/kernl/src/tool/toolkit.ts:196
Get a specific tool by ID.
Returns the tool from the local cache. The cache is populated on the first call to list(). Returns undefined if list() hasn't been called yet.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The tool ID to look up |
Returns
Tool<TContext> | undefined
The tool if found in cache, undefined otherwise
Overrides
BaseToolkit.getlist()
list(context?: Context<TContext>): Promise<Tool<TContext>[]>;Defined in: packages/kernl/src/tool/toolkit.ts:210
List all tools available from the MCP server.
Connects to the server lazily on first call. Tools are cached locally after the first fetch. The MCP server itself also handles caching via the cacheToolsList option, so the network call is only made once.
Parameters
| Parameter | Type | Description |
|---|---|---|
context? | Context<TContext> | Optional context for filtering tools |
Returns
Promise<Tool<TContext>[]>
Array of tools from the MCP server
Overrides
BaseToolkit.list