Introduce a telemetry event for when a tool finishes (#28380)

Antonio Scandurra created

This should help us understand which tools fail the most.

Release Notes:

- N/A

Change summary

crates/agent/src/tool_use.rs | 2 ++
1 file changed, 2 insertions(+)

Detailed changes

crates/agent/src/tool_use.rs 🔗

@@ -334,6 +334,8 @@ impl ToolUseState {
         output: Result<String>,
         cx: &App,
     ) -> Option<PendingToolUse> {
+        telemetry::event!("Agent Tool Finished", tool_name, success = output.is_ok());
+
         match output {
             Ok(tool_result) => {
                 let model_registry = LanguageModelRegistry::read_global(cx);