Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/telemetry/src/TelemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export class TelemetryService {
this.captureEvent(TelemetryEventName.MODE_SWITCH, { taskId, newMode })
}

public captureToolUsage(taskId: string, tool: string): void {
this.captureEvent(TelemetryEventName.TOOL_USED, { taskId, tool })
public captureToolUsage(taskId: string, tool: string, toolProtocol: string): void {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The toolProtocol parameter uses string type instead of the more specific ToolProtocol type from @roo-code/types. Using the proper type would provide compile-time safety against typos or invalid values (e.g., "nativ" instead of "native"). The ToolProtocol type is already available since @roo-code/types is a dependency of this package.

Suggested change
public captureToolUsage(taskId: string, tool: string, toolProtocol: string): void {
public captureToolUsage(taskId: string, tool: string, toolProtocol: ToolProtocol): void {

Fix it with Roo Code or mention @roomote and request a fix.

this.captureEvent(TelemetryEventName.TOOL_USED, { taskId, tool, toolProtocol })
}

public captureCheckpointCreated(taskId: string): void {
Expand Down
3 changes: 2 additions & 1 deletion src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export async function presentAssistantMessage(cline: Task) {
// XML protocol tool calls NEVER have an ID (parsed from XML text).
const toolCallId = (block as any).id
const isNative = !!toolCallId
const toolProtocol = toolCallId ? "native" : "xml"

const pushToolResult = (content: ToolResponse) => {
if (isNative && toolCallId) {
Expand Down Expand Up @@ -430,7 +431,7 @@ export async function presentAssistantMessage(cline: Task) {

if (!block.partial) {
cline.recordToolUsage(block.name)
TelemetryService.instance.captureToolUsage(cline.taskId, block.name)
TelemetryService.instance.captureToolUsage(cline.taskId, block.name, toolProtocol)
}

// Validate tool use before execution.
Expand Down