chore: introduce browser_evaluate (#678)

Fixes https://github.com/microsoft/playwright-mcp/issues/424
This commit is contained in:
Pavel Feldman 2025-07-16 15:02:47 -07:00 committed by GitHub
parent 825a97d66e
commit 012c906500
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 127 additions and 36 deletions

View file

@ -190,19 +190,19 @@ ${code.join('\n')}
result.push('');
}
if (this.tabs().length > 1)
result.push(await this.listTabsMarkdown(), '');
if (captureSnapshot && tab.hasSnapshot()) {
if (this.tabs().length > 1)
result.push(await this.listTabsMarkdown(), '');
if (this.tabs().length > 1)
result.push('### Current tab');
if (this.tabs().length > 1)
result.push('### Current tab');
result.push(
`- Page URL: ${tab.page.url()}`,
`- Page Title: ${await tab.title()}`
);
if (captureSnapshot && tab.hasSnapshot())
result.push(
`- Page URL: ${tab.page.url()}`,
`- Page Title: ${await tab.title()}`
);
result.push(tab.snapshotOrDie().text());
}
const content = actionResult?.content ?? [];