Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit 1617850

Browse files
authored
chore: add tool input / output events for debugging (#132)
1 parent 8cb1605 commit 1617850

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

typescript/src/integrations/mcp/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export class MyMCP extends McpAgent<Env> {
157157
await this.trackEvent("mcp tool call", {
158158
tool: tool.name,
159159
valid_input: false,
160+
input: params,
160161
});
161162
return [
162163
{
@@ -169,10 +170,18 @@ export class MyMCP extends McpAgent<Env> {
169170
await this.trackEvent("mcp tool call", {
170171
tool: tool.name,
171172
valid_input: true,
173+
input: params,
172174
});
173175

174176
try {
175-
return await handler(params);
177+
const result = await handler(params);
178+
await this.trackEvent("mcp tool response", {
179+
tool: tool.name,
180+
valid_input: true,
181+
input: params,
182+
output: result,
183+
});
184+
return result;
176185
} catch (error: any) {
177186
const distinctId = await this.getDistinctId();
178187
return handleToolError(error, tool.name, distinctId);

typescript/src/lib/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type AnalyticsEvent = "mcp tool call";
1+
export type AnalyticsEvent = "mcp tool call" | "mcp tool response";

0 commit comments

Comments
 (0)