Skip to content

Commit 009f887

Browse files
authored
fix(webmcp): handle Chromium tool API changes (#43578)
1 parent a2b65a0 commit 009f887

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/injected/src/webMCP.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class WebMCPScript {
114114
private _parseInputSchema(inputSchema: unknown): unknown {
115115
// Chromium before 155 hands the schema back as a JSON string.
116116
if (typeof inputSchema !== 'string')
117-
return inputSchema;
117+
return inputSchema ?? undefined;
118118
try {
119119
return JSON.parse(inputSchema);
120120
} catch {

‎tests/library/webmcp.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ test('WM-005 should throw when the tool throws', async ({ page, server, browserN
125125

126126
const error = await page.webmcp.callTool('throwing').catch(e => e);
127127
// Chromium does not report the error that the tool threw.
128-
expect(error.message).toContain(browserName === 'chromium' ? 'the invocation failed' : 'boom');
128+
expect(error.message).toMatch(browserName === 'chromium' ? /the invocation failed|Tool execution failed/ : /boom/);
129129
});
130130

131131
test('WM-006 should throw for an unknown tool', async ({ page, server }) => {

0 commit comments

Comments
 (0)