Skip to main content

ToolRegistry

@codebolt/codeboltjs


Class: ToolRegistry

Defined in: packages/codeboltjs/src/tools/registry.ts:16

Registry for managing tools

Constructors

Constructor

new ToolRegistry(): ToolRegistry;

Returns

ToolRegistry

Methods

clear()

clear(): void;

Defined in: packages/codeboltjs/src/tools/registry.ts:223

Clear all registered tools

Returns

void


executeTool()

executeTool(
name: string,
params: object,
signal?: AbortSignal,
updateOutput?: (output: string) => void): Promise<ToolFrameworkResult>;

Defined in: packages/codeboltjs/src/tools/registry.ts:119

Execute a tool by name with given parameters

Parameters

ParameterTypeDescription
namestringThe name of the tool to execute
paramsobjectThe parameters to pass to the tool
signal?AbortSignalOptional AbortSignal for cancellation
updateOutput?(output: string) => voidOptional callback for streaming output

Returns

Promise<ToolFrameworkResult>

The tool execution result


executeToolWithConfirmation()

executeToolWithConfirmation(
name: string,
params: object,
signal: AbortSignal,
onConfirmation: (details: any) => Promise<boolean>,
updateOutput?: (output: string) => void): Promise<ToolFrameworkResult>;

Defined in: packages/codeboltjs/src/tools/registry.ts:164

Execute a tool with confirmation support

Parameters

ParameterTypeDescription
namestringThe name of the tool
paramsobjectThe parameters to pass
signalAbortSignalAbortSignal for cancellation
onConfirmation(details: any) => Promise<boolean>Callback when confirmation is needed
updateOutput?(output: string) => voidOptional callback for streaming output

Returns

Promise<ToolFrameworkResult>

The tool execution result


getAllTools()

getAllTools(): AnyDeclarativeTool[];

Defined in: packages/codeboltjs/src/tools/registry.ts:71

Get all registered tools

Returns

AnyDeclarativeTool[]

Array of all registered tools


getFunctionCallSchemas()

getFunctionCallSchemas(): OpenAIFunctionCall[];

Defined in: packages/codeboltjs/src/tools/registry.ts:103

Get OpenAI function call schemas for all registered tools

Returns

OpenAIFunctionCall[]

Array of OpenAI function call schemas


getTool()

getTool(name: string):
| AnyDeclarativeTool
| undefined;

Defined in: packages/codeboltjs/src/tools/registry.ts:54

Get a tool by name

Parameters

ParameterTypeDescription
namestringThe name of the tool

Returns

| AnyDeclarativeTool | undefined

The tool if found, undefined otherwise


getToolCount()

getToolCount(): number;

Defined in: packages/codeboltjs/src/tools/registry.ts:87

Get the count of registered tools

Returns

number

Number of registered tools


getToolNames()

getToolNames(): string[];

Defined in: packages/codeboltjs/src/tools/registry.ts:79

Get the names of all registered tools

Returns

string[]

Array of tool names


getToolSchemas()

getToolSchemas(): OpenAIToolSchema[];

Defined in: packages/codeboltjs/src/tools/registry.ts:95

Get OpenAI tool schemas for all registered tools

Returns

OpenAIToolSchema[]

Array of OpenAI tool schemas


hasTool()

hasTool(name: string): boolean;

Defined in: packages/codeboltjs/src/tools/registry.ts:63

Check if a tool is registered

Parameters

ParameterTypeDescription
namestringThe name of the tool

Returns

boolean

true if the tool is registered


registerTool()

registerTool(tool: AnyDeclarativeTool): void;

Defined in: packages/codeboltjs/src/tools/registry.ts:23

Register a tool with the registry

Parameters

ParameterTypeDescription
toolAnyDeclarativeToolThe tool to register

Returns

void


registerTools()

registerTools(tools: AnyDeclarativeTool[]): void;

Defined in: packages/codeboltjs/src/tools/registry.ts:34

Register multiple tools at once

Parameters

ParameterTypeDescription
toolsAnyDeclarativeTool[]Array of tools to register

Returns

void


unregisterTool()

unregisterTool(name: string): boolean;

Defined in: packages/codeboltjs/src/tools/registry.ts:45

Unregister a tool by name

Parameters

ParameterTypeDescription
namestringThe name of the tool to unregister

Returns

boolean

true if the tool was found and removed