kernl

Class: MCPToolkit<TContext>

Defined in: packages/kernl/src/tool/toolkit.ts:161

Extends

  • BaseToolkit<TContext>

Type Parameters

Type ParameterDefault type
TContextUnknownContext

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

ParameterTypeDescription
configMCPToolkitConfig<TContext>Toolkit configuration with id and server instance

Returns

MCPToolkit<TContext>

Overrides

BaseToolkit<TContext>.constructor

Properties

PropertyModifierTypeDescriptionOverridesInherited fromDefined in
agent?protectedBaseAgent<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.agentpackages/kernl/src/tool/toolkit.ts:37
descriptionreadonlystringDescription of what this toolkit providesBaseToolkit.description-packages/kernl/src/tool/toolkit.ts:165
idreadonlystringUnique identifier for this toolkitBaseToolkit.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

ParameterType
agentBaseAgent<any>

Returns

void

Inherited from

BaseToolkit.bind

destroy()

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.destroy

get()

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

ParameterTypeDescription
idstringThe tool ID to look up

Returns

Tool<TContext> | undefined

The tool if found in cache, undefined otherwise

Overrides

BaseToolkit.get

list()

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

ParameterTypeDescription
context?Context<TContext>Optional context for filtering tools

Returns

Promise<Tool<TContext>[]>

Array of tools from the MCP server

Overrides

BaseToolkit.list

On this page