BaseDeclarativeTool
Abstract Class: BaseDeclarativeTool<TParams, TResult>
Defined in: packages/codeboltjs/src/tools/base-tool.ts:211
Base class for declarative tools with built-in validation
Extends
DeclarativeTool<TParams,TResult>
Extended by
ReadFileToolWriteFileToolEditToolListDirectoryToolReadManyFilesToolGlobToolGrepToolSearchFilesToolCodebaseSearchToolSearchMcpToolToolListCodeDefinitionNamesToolExecuteCommandToolGitInitToolGitStatusToolGitAddToolGitCommitToolGitPushToolGitPullToolGitCheckoutToolGitBranchToolGitLogsToolGitDiffToolGitCloneToolBrowserNavigateToolBrowserScreenshotToolBrowserClickToolBrowserTypeToolBrowserScrollToolBrowserGetContentToolBrowserGetHtmlToolBrowserGetMarkdownToolBrowserGetUrlToolBrowserCloseToolBrowserEnterToolBrowserSearchToolTaskCreateToolTaskUpdateToolTaskDeleteToolTaskListToolTaskGetToolTaskAssignToolTaskExecuteToolAgentFindToolAgentStartToolAgentListToolAgentDetailsToolThreadCreateToolThreadCreateStartToolThreadCreateBackgroundToolThreadListToolThreadGetToolThreadStartToolThreadUpdateToolThreadDeleteToolThreadGetMessagesToolThreadUpdateStatusToolOrchestratorListToolOrchestratorGetToolOrchestratorGetSettingsToolOrchestratorCreateToolOrchestratorUpdateToolOrchestratorUpdateSettingsToolOrchestratorDeleteToolOrchestratorUpdateStatusTool
Type Parameters
| Type Parameter |
|---|
TParams extends object |
TResult extends ToolFrameworkResult |
Constructors
Constructor
new BaseDeclarativeTool<TParams, TResult>(
name: string,
displayName: string,
description: string,
kind: Kind,
parameterSchema: unknown,
isOutputMarkdown: boolean,
canUpdateOutput: boolean): BaseDeclarativeTool<TParams, TResult>;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:62
Parameters
| Parameter | Type | Default value |
|---|---|---|
name | string | undefined |
displayName | string | undefined |
description | string | undefined |
kind | Kind | undefined |
parameterSchema | unknown | undefined |
isOutputMarkdown | boolean | true |
canUpdateOutput | boolean | false |
Returns
BaseDeclarativeTool<TParams, TResult>
Inherited from
Properties
| Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|---|
canUpdateOutput | readonly | boolean | false | Whether the tool supports live (streaming) output | DeclarativeTool.canUpdateOutput | packages/codeboltjs/src/tools/base-tool.ts:69 |
description | readonly | string | undefined | Description of what the tool does | DeclarativeTool.description | packages/codeboltjs/src/tools/base-tool.ts:65 |
displayName | readonly | string | undefined | The user-friendly display name of the tool | DeclarativeTool.displayName | packages/codeboltjs/src/tools/base-tool.ts:64 |
isOutputMarkdown | readonly | boolean | true | Whether the tool's output should be rendered as markdown | DeclarativeTool.isOutputMarkdown | packages/codeboltjs/src/tools/base-tool.ts:68 |
kind | readonly | Kind | undefined | The kind of tool for categorization and permissions | DeclarativeTool.kind | packages/codeboltjs/src/tools/base-tool.ts:66 |
name | readonly | string | undefined | The internal name of the tool (used for API calls) | DeclarativeTool.name | packages/codeboltjs/src/tools/base-tool.ts:63 |
parameterSchema | readonly | unknown | undefined | - | DeclarativeTool.parameterSchema | packages/codeboltjs/src/tools/base-tool.ts:67 |
Accessors
explanation
Get Signature
get explanation(): string;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:76
One sentence explanation as to why this tool is being used, and how it contributes to the goal. Defaults to description if not implemented by subclass.
Returns
string
One sentence explanation as to why this tool is being used, and how it contributes to the goal.
Inherited from
genAISchema
Get Signature
get genAISchema(): FunctionDeclaration;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:118
Get Google GenAI schema format (for backward compatibility)
Returns
FunctionDeclaration
Function declaration schema for Google GenAI (for backward compatibility)
Inherited from
openAIFunctionCall
Get Signature
get openAIFunctionCall(): OpenAIFunctionCall;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:102
Get OpenAI function call format
Returns
Inherited from
DeclarativeTool.openAIFunctionCall
schema
Get Signature
get schema(): OpenAIToolSchema;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:83
Primary schema format (OpenAI tool schema)
Returns
Primary schema format (OpenAI tool schema)
Inherited from
Methods
build()
build(params: TParams): ToolInvocation<TParams, TResult>;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:215
The core of the pattern. It validates parameters and, if successful,
returns a ToolInvocation object that encapsulates the logic for the
specific, validated call.
Parameters
| Parameter | Type |
|---|---|
params | TParams |
Returns
ToolInvocation<TParams, TResult>
Overrides
buildAndExecute()
buildAndExecute(
params: TParams,
signal: AbortSignal,
updateOutput?: (output: string) => void): Promise<TResult>;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:145
A convenience method that builds and executes the tool in one step.
Parameters
| Parameter | Type |
|---|---|
params | TParams |
signal | AbortSignal |
updateOutput? | (output: string) => void |
Returns
Promise<TResult>
Inherited from
DeclarativeTool.buildAndExecute
createInvocation()
abstract protected createInvocation(params: TParams): ToolInvocation<TParams, TResult>;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:239
Parameters
| Parameter | Type |
|---|---|
params | TParams |
Returns
ToolInvocation<TParams, TResult>
validateBuildAndExecute()
validateBuildAndExecute(params: TParams, abortSignal: AbortSignal): Promise<ToolFrameworkResult>;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:174
A convenience method that builds and executes the tool in one step. Never throws.
Parameters
| Parameter | Type |
|---|---|
params | TParams |
abortSignal | AbortSignal |
Returns
Promise<ToolFrameworkResult>
Inherited from
DeclarativeTool.validateBuildAndExecute
validateToolParams()
validateToolParams(params: TParams): string | null;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:223
Validates the raw tool parameters. Subclasses should override this to add custom validation logic beyond the JSON schema check.
Parameters
| Parameter | Type |
|---|---|
params | TParams |
Returns
string | null
Overrides
DeclarativeTool.validateToolParams
validateToolParamValues()
protected validateToolParamValues(_params: TParams): string | null;
Defined in: packages/codeboltjs/src/tools/base-tool.ts:235
Parameters
| Parameter | Type |
|---|---|
_params | TParams |
Returns
string | null