Skip to content

Commit a8dba8d

Browse files
committed
fix: refactor registerMcpTools function for improved module initialization
1 parent 1feb557 commit a8dba8d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

site/src/clientModules/webmcp.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// https://webmachinelearning.github.io/webmcp/
33
let controller: AbortController | null = null;
44

5-
export function onRouteDidUpdate(): void {
5+
function registerMcpTools(): void {
66
if (typeof navigator === 'undefined' || !('modelContext' in navigator)) {
77
return;
88
}
@@ -67,3 +67,9 @@ export function onRouteDidUpdate(): void {
6767
signal,
6868
});
6969
}
70+
71+
// Run immediately when the module loads and on every route change.
72+
registerMcpTools();
73+
export function onRouteDidUpdate(): void {
74+
registerMcpTools();
75+
}

0 commit comments

Comments
 (0)