Method AddBuiltIns
AddBuiltIns(ToolRegistry, Action<BuiltInToolSelection>)
Registers built-in tools selected through a fluent selector.
public static ToolRegistry AddBuiltIns(this ToolRegistry registry, Action<BuiltInToolSelection> configure)
Parameters
registryToolRegistryThe tool registry to populate.
configureAction<BuiltInToolSelection>A delegate that configures the BuiltInToolSelection filters.
Returns
- ToolRegistry
The same
registryinstance, for fluent chaining.
Examples
Example: Registering only low-risk I/O tools
var registry = new ToolRegistry();
registry.AddBuiltIns(selection => selection
.Category("io")
.MaxRisk(ToolRiskLevel.Low));
Example: Cherry-picking individual tools by name
var registry = new ToolRegistry();
registry.AddBuiltIns(selection => selection
.Include("http_get")
.Include("websearch")
.Include("calculator"));
AddBuiltIns(ToolRegistry, Action<BuiltInToolSelection>, Action<BuiltInToolRegistrationOptions>)
Registers built-in tools selected through a fluent selector and optional instantiation overrides.
public static ToolRegistry AddBuiltIns(this ToolRegistry registry, Action<BuiltInToolSelection> configure, Action<BuiltInToolRegistrationOptions> configureOptions)
Parameters
registryToolRegistryThe tool registry to populate.
configureAction<BuiltInToolSelection>A delegate that configures the BuiltInToolSelection filters.
configureOptionsAction<BuiltInToolRegistrationOptions>An optional delegate that configures BuiltInToolRegistrationOptions to override how specific tools are instantiated.
Returns
- ToolRegistry
The same
registryinstance, for fluent chaining.
Examples
Example: Registering data tools with custom XML options
var registry = new ToolRegistry();
registry.AddBuiltIns(
selection => selection.Category("data"),
options => options.Xml(new XmlToolOptions { MaxDepth = 32 }));
Example: Overriding a specific tool factory
var registry = new ToolRegistry();
registry.AddBuiltIns(
selection => selection.Category("net"),
options => options.Override("websearch",
() => BuiltInTools.CreateWebSearch(WebSearchTool.Provider.Brave, "my-api-key")));
AddBuiltIns(ToolRegistry, BuiltInProfile)
Registers built-in tools matching a predefined profile.
public static ToolRegistry AddBuiltIns(this ToolRegistry registry, BuiltInProfile profile)
Parameters
registryToolRegistryThe tool registry to populate.
profileBuiltInProfile
Returns
- ToolRegistry
The same
registryinstance, for fluent chaining.
Examples
Example: Registering all built-in tools
var registry = new ToolRegistry();
registry.AddBuiltIns(BuiltInProfiles.All);
Example: Registering only safe, read-only tools
var registry = new ToolRegistry();
registry.AddBuiltIns(BuiltInProfiles.SafeOnly);
AddBuiltIns(ToolRegistry, BuiltInProfile, Action<BuiltInToolRegistrationOptions>)
Registers built-in tools matching a predefined profile and optional instantiation overrides.
public static ToolRegistry AddBuiltIns(this ToolRegistry registry, BuiltInProfile profile, Action<BuiltInToolRegistrationOptions> configureOptions)
Parameters
registryToolRegistryThe tool registry to populate.
profileBuiltInProfileconfigureOptionsAction<BuiltInToolRegistrationOptions>An optional delegate that configures BuiltInToolRegistrationOptions to override how specific tools are instantiated.
Returns
- ToolRegistry
The same
registryinstance, for fluent chaining.
Examples
Example: Registering all tools with a custom web-search provider
var registry = new ToolRegistry();
registry.AddBuiltIns(
BuiltInProfiles.All,
options => options.Override("websearch",
() => BuiltInTools.CreateWebSearch(WebSearchTool.Provider.Tavily, "my-api-key")));