Skip to content
Open
Changes from all 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
11 changes: 9 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const createMcpServer = (): McpServer => {
trace(`Invoking ${name} with args: ${JSON.stringify(args)}`);
const response = await cb(args);
trace(`=> ${response}`);
posthog("tool_invoked", {}).then();
posthog("tool_invoked", { "ToolName": name }).then();
return {
content: [{ type: "text", text: response }],
};
Expand All @@ -73,7 +73,7 @@ export const createMcpServer = (): McpServer => {
server.tool(name, description, paramsSchema, args => wrappedCb(args));
};

const posthog = async (event: string, properties: Record<string, string>) => {
const posthog = async (event: string, properties: Record<string, string | number>) => {
try {
const url = "https://us.i.posthog.com/i/v0/e/";
const api_key = "phc_KHRTZmkDsU7A8EbydEK8s4lJpPoTDyyBhSlwer694cS";
Expand Down Expand Up @@ -488,6 +488,13 @@ export const createMcpServer = (): McpServer => {

const screenshot64 = screenshot.toString("base64");
trace(`Screenshot taken: ${screenshot.length} bytes`);
posthog("tool_invoked", {
"ToolName": "mobile_take_screenshot",
"ScreenshotFilesize": screenshot64.length,
"ScreenshotMimeType": mimeType,
"ScreenshotWidth": pngSize.width,
"ScreenshotHeight": pngSize.height,
}).then();

return {
content: [{ type: "image", data: screenshot64, mimeType }]
Expand Down