Skip to content

Commit 899ecb5

Browse files
authored
refactor(mcp-app): remove frontend analytics event tool (tldraw#8188)
In order to simplify the MCP app and remove frontend analytics tracking, this PR removes the `event` MCP tool and the `trackWidgetEvent` callback that was used to report widget events (e.g. "build_it_clicked") to Cloudflare Analytics. ### Change type - [x] `other` ### Test plan 1. Run the MCP app and verify the share panel "Build it" button still works 2. Confirm no errors in the console related to the event tool - [ ] Unit tests - [ ] End to end tests Made with [Cursor](https://cursor.com) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: removes a best-effort analytics-only tool and its caller without affecting core canvas/checkpoint functionality. Main risk is any external dependency on the `event` tool name in clients. > > **Overview** > Removes the app-only MCP tool `event` (and its Cloudflare Analytics datapoint writes) from `register-tools.ts`. > > Simplifies the widget share panel by deleting `trackWidgetEvent` and no longer emitting the `build_it_clicked` event when the **Build it** button is pressed; button behavior otherwise remains unchanged. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b8b0dcf. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent bf934d5 commit 899ecb5

2 files changed

Lines changed: 1 addition & 51 deletions

File tree

apps/mcp-app/src/register-tools.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -568,40 +568,6 @@ export function registerTools(
568568
}
569569
)
570570

571-
// --- event (app-only) ---
572-
573-
server.registerTool(
574-
'event',
575-
{
576-
inputSchema: z.object({
577-
event: z.string().min(1),
578-
value: z.number().optional(),
579-
}),
580-
annotations: {
581-
readOnlyHint: false,
582-
destructiveHint: false,
583-
idempotentHint: false,
584-
openWorldHint: true,
585-
},
586-
_meta: { ui: { visibility: ['app'] } },
587-
},
588-
async ({ event, value }: { event: string; value?: number }): Promise<CallToolResult> => {
589-
analytics?.writeDataPoint(
590-
typeof value === 'number'
591-
? {
592-
blobs: [event],
593-
doubles: [value],
594-
}
595-
: {
596-
blobs: [event],
597-
}
598-
)
599-
return {
600-
content: [{ type: 'text', text: 'Tracked widget event.' }],
601-
}
602-
}
603-
)
604-
605571
// --- canvas resource ---
606572

607573
registerAppResource(

apps/mcp-app/src/widget/mcp-app.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,24 +69,8 @@ function SharePanelContent() {
6969
return isHostCodeEditor(hostName)
7070
}, [hostName])
7171

72-
const trackWidgetEvent = useCallback(
73-
(event: string) => {
74-
if (!app) return
75-
app
76-
.callServerTool({
77-
name: 'event',
78-
arguments: { event },
79-
})
80-
.catch(() => {
81-
// no-op best effort
82-
})
83-
},
84-
[app]
85-
)
86-
8772
const handleBuildItClick = useCallback(() => {
8873
if (!app) return
89-
trackWidgetEvent('build_it_clicked')
9074
const messageText =
9175
lastEditor === 'user'
9276
? "Hey I've made some edits to the canvas. The new canvas state is attached. Take the changes and implement them in the codebase."
@@ -100,7 +84,7 @@ function SharePanelContent() {
10084
},
10185
],
10286
})
103-
}, [app, lastEditor, trackWidgetEvent])
87+
}, [app, lastEditor])
10488

10589
return (
10690
<div className="tlui-share-zone" draggable={false} style={{ display: 'flex', gap: 4 }}>

0 commit comments

Comments
 (0)