registerBuiltinTools method
void
registerBuiltinTools({
- Tool? bashTool,
- Tool? fileReadTool,
- Tool? fileWriteTool,
- Tool? fileEditTool,
- Tool? globTool,
- Tool? grepTool,
- Tool? agentTool,
- Tool? sendMessageTool,
- Tool? todoWriteTool,
- Tool? taskOutputTool,
- Tool? toolSearchTool,
- Tool? webFetchTool,
- Tool? webSearchTool,
- Tool? notebookEditTool,
- Tool? skillTool,
- Tool? enterPlanModeTool,
- Tool? exitPlanModeTool,
- Tool? powerShellTool,
Register all 18+ built-in tools.
Call this during app initialization. Tools are registered with their appropriate categories. Pass tool instances for tools that require constructor parameters (e.g., BashTool with a working directory).
Implementation
void registerBuiltinTools({
Tool? bashTool,
Tool? fileReadTool,
Tool? fileWriteTool,
Tool? fileEditTool,
Tool? globTool,
Tool? grepTool,
Tool? agentTool,
Tool? sendMessageTool,
Tool? todoWriteTool,
Tool? taskOutputTool,
Tool? toolSearchTool,
Tool? webFetchTool,
Tool? webSearchTool,
Tool? notebookEditTool,
Tool? skillTool,
Tool? enterPlanModeTool,
Tool? exitPlanModeTool,
Tool? powerShellTool,
}) {
// File tools.
if (fileReadTool != null) {
register(fileReadTool, category: ToolCategory.file);
}
if (fileWriteTool != null) {
register(fileWriteTool, category: ToolCategory.file);
}
if (fileEditTool != null) {
register(fileEditTool, category: ToolCategory.file);
}
// Search tools.
if (globTool != null) register(globTool, category: ToolCategory.search);
if (grepTool != null) register(grepTool, category: ToolCategory.search);
if (toolSearchTool != null) {
register(toolSearchTool, category: ToolCategory.search);
}
// System tools.
if (bashTool != null) register(bashTool, category: ToolCategory.system);
if (powerShellTool != null) {
register(powerShellTool, category: ToolCategory.system);
}
// Web tools.
if (webFetchTool != null) {
register(webFetchTool, category: ToolCategory.web);
}
if (webSearchTool != null) {
register(webSearchTool, category: ToolCategory.web);
}
// Agent tools.
if (agentTool != null) register(agentTool, category: ToolCategory.agent);
if (sendMessageTool != null) {
register(sendMessageTool, category: ToolCategory.agent);
}
if (taskOutputTool != null) {
register(taskOutputTool, category: ToolCategory.agent);
}
// Editor tools.
if (notebookEditTool != null) {
register(notebookEditTool, category: ToolCategory.editor);
}
if (todoWriteTool != null) {
register(todoWriteTool, category: ToolCategory.editor);
}
if (skillTool != null) register(skillTool, category: ToolCategory.editor);
// Plan mode tools.
if (enterPlanModeTool != null) {
register(enterPlanModeTool, category: ToolCategory.system);
}
if (exitPlanModeTool != null) {
register(exitPlanModeTool, category: ToolCategory.system);
}
}