forked from bobmatnyc/claude-mpm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinspect-tool-event.js
More file actions
43 lines (35 loc) · 1.36 KB
/
inspect-tool-event.js
File metadata and controls
43 lines (35 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch({ headless: false });
const context = await browser.newContext({ viewport: { width: 1920, height: 1080 } });
const page = await context.newPage();
page.on('console', msg => console.log(`[CONSOLE] ${msg.text()}`));
try {
await page.goto('http://localhost:8765', { waitUntil: 'networkidle' });
await page.waitForTimeout(3000);
// Click on the first pre_tool event
const eventRow = await page.$('tr:has-text("pre_tool")');
if (eventRow) {
console.log('Clicking on pre_tool event...');
await eventRow.click();
await page.waitForTimeout(1000);
// Get the JSON from the right panel
const jsonContent = await page.textContent('body');
// Try to extract tool_name
const toolNameMatch = jsonContent.match(/"tool_name":\s*"([^"]+)"/);
if (toolNameMatch) {
console.log(`\nTool name found: "${toolNameMatch[1]}"`);
}
// Take screenshot showing the event details
await page.screenshot({ path: 'event-detail.png', fullPage: true });
console.log('Screenshot saved: event-detail.png');
} else {
console.log('No pre_tool event found');
}
await page.waitForTimeout(5000);
} catch (error) {
console.error('Error:', error);
} finally {
await browser.close();
}
})();