diff --git a/src/context.ts b/src/context.ts index 76f461c..49472cc 100644 --- a/src/context.ts +++ b/src/context.ts @@ -125,7 +125,7 @@ export class Context { async run(tool: Tool, params: Record | undefined) { // Tab management is done outside of the action() call. - const toolResult = await tool.handle(this, tool.schema.inputSchema.parse(params)); + const toolResult = await tool.handle(this, tool.schema.inputSchema.parse(params || {})); const { code, action, waitForNetwork, captureSnapshot, resultOverride } = toolResult; const racingAction = action ? () => this._raceAgainstModalDialogs(action) : undefined; diff --git a/tests/cdp.spec.ts b/tests/cdp.spec.ts index 7f437e4..4d2ff65 100644 --- a/tests/cdp.spec.ts +++ b/tests/cdp.spec.ts @@ -37,7 +37,6 @@ test('cdp server reuse tab', async ({ cdpEndpoint, startClient }) => { expect(await client.callTool({ name: 'browser_snapshot', - arguments: {}, })).toHaveTextContent(` - Ran Playwright code: \`\`\`js diff --git a/tests/console.spec.ts b/tests/console.spec.ts index 781db5a..8a9f60a 100644 --- a/tests/console.spec.ts +++ b/tests/console.spec.ts @@ -36,7 +36,6 @@ test('browser_console_messages', async ({ client, server }) => { const resource = await client.callTool({ name: 'browser_console_messages', - arguments: {}, }); expect(resource).toHaveTextContent([ '[LOG] Hello, world!', diff --git a/tests/core.spec.ts b/tests/core.spec.ts index 9d4f058..003ea98 100644 --- a/tests/core.spec.ts +++ b/tests/core.spec.ts @@ -175,7 +175,6 @@ test('browser_type', async ({ client, server }) => { }); expect(await client.callTool({ name: 'browser_console_messages', - arguments: {}, })).toHaveTextContent('[LOG] Key pressed: Enter , Text: Hi!'); }); @@ -202,7 +201,6 @@ test('browser_type (slowly)', async ({ client, server }) => { }); expect(await client.callTool({ name: 'browser_console_messages', - arguments: {}, })).toHaveTextContent([ '[LOG] Key pressed: H Text: ', '[LOG] Key pressed: i Text: H', @@ -237,5 +235,5 @@ test('browser_resize', async ({ client, server }) => { // Resize browser window to 390x780 await page.setViewportSize({ width: 390, height: 780 }); \`\`\``); - await expect.poll(() => client.callTool({ name: 'browser_snapshot', arguments: {} })).toContainTextContent('Window size: 390x780'); + await expect.poll(() => client.callTool({ name: 'browser_snapshot' })).toContainTextContent('Window size: 390x780'); }); diff --git a/tests/files.spec.ts b/tests/files.spec.ts index cce1b9a..8280bb0 100644 --- a/tests/files.spec.ts +++ b/tests/files.spec.ts @@ -121,7 +121,7 @@ test('clicking on download link emits download', async ({ startClient, localOutp ref: 'e2', }, }); - await expect.poll(() => client.callTool({ name: 'browser_snapshot', arguments: {} })).toContainTextContent(` + await expect.poll(() => client.callTool({ name: 'browser_snapshot' })).toContainTextContent(` ### Downloads - Downloaded file test.txt to ${path.join(outputDir, 'test.txt')}`); }); diff --git a/tests/install.spec.ts b/tests/install.spec.ts index 34ce5bb..66a11d5 100644 --- a/tests/install.spec.ts +++ b/tests/install.spec.ts @@ -20,6 +20,5 @@ test('browser_install', async ({ client, mcpBrowser }) => { test.skip(mcpBrowser !== 'chromium', 'Test only chromium'); expect(await client.callTool({ name: 'browser_install', - arguments: {}, })).toContainTextContent(`No open pages available.`); }); diff --git a/tests/launch.spec.ts b/tests/launch.spec.ts index 9bfba46..d263abd 100644 --- a/tests/launch.spec.ts +++ b/tests/launch.spec.ts @@ -24,7 +24,6 @@ test('test reopen browser', async ({ client, server }) => { expect(await client.callTool({ name: 'browser_close', - arguments: {}, })).toContainTextContent('No open pages available'); expect(await client.callTool({ diff --git a/tests/network.spec.ts b/tests/network.spec.ts index 47b335a..56e71c0 100644 --- a/tests/network.spec.ts +++ b/tests/network.spec.ts @@ -40,7 +40,6 @@ test('browser_network_requests', async ({ client, server }) => { await expect.poll(() => client.callTool({ name: 'browser_network_requests', - arguments: {}, })).toHaveTextContent(`[GET] ${`${server.PREFIX}`} => [200] OK [GET] ${`${server.PREFIX}json`} => [200] OK`); }); diff --git a/tests/pdf.spec.ts b/tests/pdf.spec.ts index 120a6ca..1e870e6 100644 --- a/tests/pdf.spec.ts +++ b/tests/pdf.spec.ts @@ -40,7 +40,6 @@ test('save as pdf', async ({ client, mcpBrowser, server }) => { const response = await client.callTool({ name: 'browser_pdf_save', - arguments: {}, }); expect(response).toHaveTextContent(/Save page as.*page-[^:]+.pdf/); }); diff --git a/tests/screenshot.spec.ts b/tests/screenshot.spec.ts index 1c80dda..1909a8b 100644 --- a/tests/screenshot.spec.ts +++ b/tests/screenshot.spec.ts @@ -26,7 +26,6 @@ test('browser_take_screenshot (viewport)', async ({ client, server }) => { expect(await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, })).toEqual({ content: [ { @@ -81,7 +80,6 @@ test('--output-dir should work', async ({ startClient, localOutputPath, server } await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, }); expect(fs.existsSync(outputDir)).toBeTruthy(); @@ -180,12 +178,10 @@ test('browser_take_screenshot (noImageResponses)', async ({ startClient, server await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, }); expect(await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, })).toEqual({ content: [ { @@ -206,12 +202,10 @@ test('browser_take_screenshot (cursor)', async ({ startClient, server }) => { await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, }); expect(await client.callTool({ name: 'browser_take_screenshot', - arguments: {}, })).toEqual({ content: [ { diff --git a/tests/tabs.spec.ts b/tests/tabs.spec.ts index 99652d9..1972782 100644 --- a/tests/tabs.spec.ts +++ b/tests/tabs.spec.ts @@ -32,7 +32,6 @@ async function createTab(client: Client, title: string, body: string) { test('list initial tabs', async ({ client }) => { expect(await client.callTool({ name: 'browser_tab_list', - arguments: {}, })).toHaveTextContent(`### Open tabs - 1: (current) [] (about:blank)`); }); @@ -41,7 +40,6 @@ test('list first tab', async ({ client }) => { await createTab(client, 'Tab one', 'Body one'); expect(await client.callTool({ name: 'browser_tab_list', - arguments: {}, })).toHaveTextContent(`### Open tabs - 1: [] (about:blank) - 2: (current) [Tab one] (data:text/html,Tab oneBody one)`);