IToolRegistry (src/SharpClaw.Code.Tools/Abstractions/IToolRegistry.cs) exposes:
ListAsync,SearchAsync,GetRequiredAsync(allasync; plugin tools are loaded withCancellationToken)
ToolRegistry merges:
- All
ISharpClawToolinstances registered in DI (built-ins). - Optional plugin tool descriptors from
IPluginManager.ListToolDescriptorsAsyncwrapped asPluginToolProxyTool(only for enabled plugins — seePluginManager).
Registration: ToolsServiceCollectionExtensions.AddSharpClawTools.
ToolExecutor (IToolExecutor):
- Resolves the tool.
- Builds
ToolExecutionRequest+PermissionEvaluationContext(includesPluginToolSourcewhen applicable). - Publishes
ToolStartedEvent,PermissionRequestedEvent,PermissionResolvedEvent,ToolCompletedEventthroughIRuntimeEventPublisherwhen registered. - Calls
IPermissionPolicyEngine.EvaluateAsync; on allow,ISharpClawTool.ExecuteAsync.
From ToolsServiceCollectionExtensions:
| Tool | Constant / name |
|---|---|
| Read file | ReadFileTool.ToolName |
| Write file | WriteFileTool.ToolName |
| Edit file | EditFileTool.ToolName |
| Glob search | GlobSearchTool.ToolName |
| Grep search | GrepSearchTool.ToolName |
| Bash / shell | BashTool.ToolName |
| Web search | WebSearchTool |
| Web fetch | WebFetchTool |
| Tool search | ToolSearchTool.ToolName (tool_search) |
Each built-in is registered both as a concrete singleton and as ISharpClawTool.
- Subclass
SharpClawToolBase(src/SharpClaw.Code.Tools/BuiltIn/SharpClawToolBase.cs). - Implement
DefinitionasToolDefinition(name, description,ApprovalScope,RequiresApproval,IsDestructive, input type name, tags). - Implement
ExecuteAsync: parse arguments withDeserializeArguments<T>, returnCreateSuccessResult/CreateFailureResult. - Register in
ToolsServiceCollectionExtensions.AddSharpClawTools:services.AddSingleton<YourTool>();services.AddSingleton<ISharpClawTool>(sp => sp.GetRequiredService<YourTool>());
Use Protocol types for stable payloads where appropriate; tool JSON helpers live in ToolJson (Tools/Utilities).
tool_searchqueriesIToolRegistry.SearchAsync.- End-to-end LLM-driven tool use in the default agent path is not wired through
AgentFrameworkBridgetoday;AgentRunContext.ToolExecutoris available for future or alternate agent implementations.
See permissions.md for gates on destructive and elevated tools.