Initial commit
This commit is contained in:
41
skills/mcp-chrome-devtools/scripts/take_snapshot.js
Executable file
41
skills/mcp-chrome-devtools/scripts/take_snapshot.js
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* MCP Server: chrome-devtools
|
||||
* Server Version: 0.10.2
|
||||
* Generated: 2025-11-23
|
||||
* Tool: take_snapshot
|
||||
*
|
||||
* Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique
|
||||
identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
|
||||
in the DevTools Elements panel (if any).
|
||||
*/
|
||||
|
||||
import { program } from 'commander';
|
||||
import { callTool } from './mcp_client.js';
|
||||
|
||||
program
|
||||
.name('take_snapshot')
|
||||
.description('Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique\nidentifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected\nin the DevTools Elements panel (if any).')
|
||||
.option('--verbose', 'Whether to include all possible information available in the full a11y tree. Default is false.')
|
||||
.option('--filePath <value>', 'The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.')
|
||||
.parse();
|
||||
|
||||
const options = program.opts();
|
||||
|
||||
// Build arguments object
|
||||
const args = {};
|
||||
if (options.verbose) {
|
||||
args['verbose'] = true;
|
||||
}
|
||||
if (options.filePath !== undefined) {
|
||||
args['filePath'] = options.filePath;
|
||||
}
|
||||
|
||||
// Call the tool
|
||||
try {
|
||||
const result = await callTool('chrome-devtools', 'take_snapshot', args);
|
||||
console.log(result);
|
||||
} catch (error) {
|
||||
console.error('Error:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user