fix(browser): distinguish WebMCP registration frame owners (#813)

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
This commit is contained in:
Rudy Mizrahi Celekli
2026-10-07 10:19:49 +08:00
committed by GitHub
parent 02beb74535
commit b3b44d8a2d
6 changed files with 113 additions and 14 deletions
+3 -3
View File
@@ -410,7 +410,7 @@ const normalizeTool = (
const description = stringValue(value.description) ?? "";
const annotations = recordValue(value.annotations);
return {
tool_key: toolKey(frame.url, name),
tool_key: toolKey(frame.url, frameId, name),
name,
description,
frame_id: frameId,
@@ -497,8 +497,8 @@ const buildWebMcpResult = (options: WebMcpResultOptions): WebMcpDiscovery => {
};
};
const toolKey = (frameUrl: string, name: string): string =>
`webmcp_${createHash("sha256").update(`${frameUrl}\0${name}`).digest("hex")}`;
const toolKey = (frameUrl: string, frameId: string, name: string): string =>
`webmcp_${createHash("sha256").update(`${frameUrl}\0${frameId}\0${name}`).digest("hex")}`;
const booleanOrNull = (value: unknown): boolean | null =>
typeof value === "boolean" ? value : null;