Initial commit
This commit is contained in:
45
skills/mcp-chrome-devtools/scripts/new_page.js
Executable file
45
skills/mcp-chrome-devtools/scripts/new_page.js
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* MCP Server: chrome-devtools
|
||||
* Server Version: 0.10.2
|
||||
* Generated: 2025-11-23
|
||||
* Tool: new_page
|
||||
*
|
||||
* Creates a new page
|
||||
*/
|
||||
|
||||
import { program } from 'commander';
|
||||
import { callTool } from './mcp_client.js';
|
||||
|
||||
program
|
||||
.name('new_page')
|
||||
.description('Creates a new page')
|
||||
.option('--url <value>', 'URL to load in a new page. (required)')
|
||||
.option('--timeout <value>', 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.', (val) => parseInt(val, 10))
|
||||
.parse();
|
||||
|
||||
const options = program.opts();
|
||||
|
||||
// Validate required options
|
||||
if (!options.url) {
|
||||
console.error('Error: --url is required');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Build arguments object
|
||||
const args = {};
|
||||
if (options.url !== undefined) {
|
||||
args['url'] = options.url;
|
||||
}
|
||||
if (options.timeout !== undefined) {
|
||||
args['timeout'] = options.timeout;
|
||||
}
|
||||
|
||||
// Call the tool
|
||||
try {
|
||||
const result = await callTool('chrome-devtools', 'new_page', args);
|
||||
console.log(result);
|
||||
} catch (error) {
|
||||
console.error('Error:', error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user