Skip to content

Commit 218eb81

Browse files
committed
feat: add toolProtocol property to PostHog tool usage telemetry
1 parent b0c254c commit 218eb81

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/telemetry/src/TelemetryService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ export class TelemetryService {
9898
this.captureEvent(TelemetryEventName.MODE_SWITCH, { taskId, newMode })
9999
}
100100

101-
public captureToolUsage(taskId: string, tool: string): void {
102-
this.captureEvent(TelemetryEventName.TOOL_USED, { taskId, tool })
101+
public captureToolUsage(taskId: string, tool: string, toolProtocol?: string): void {
102+
this.captureEvent(TelemetryEventName.TOOL_USED, { taskId, tool, toolProtocol })
103103
}
104104

105105
public captureCheckpointCreated(taskId: string): void {

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,10 @@ export async function presentAssistantMessage(cline: Task) {
430430

431431
if (!block.partial) {
432432
cline.recordToolUsage(block.name)
433-
TelemetryService.instance.captureToolUsage(cline.taskId, block.name)
433+
// Determine protocol: native if tool has an ID, otherwise XML
434+
const toolCallId = (block as any).id
435+
const toolProtocol = toolCallId ? "native" : "xml"
436+
TelemetryService.instance.captureToolUsage(cline.taskId, block.name, toolProtocol)
434437
}
435438

436439
// Validate tool use before execution.

0 commit comments

Comments
 (0)