Skip to content

Commit 072e699

Browse files
Merge branch 'main' into feat/skills/lcp
2 parents 7e6f29a + c402b43 commit 072e699

12 files changed

Lines changed: 504 additions & 172 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ Add the following config to your MCP client:
7373
> [!NOTE]
7474
> Using `chrome-devtools-mcp@latest` ensures that your MCP client will always use the latest version of the Chrome DevTools MCP server.
7575
76+
If you are intersted in doing only basic browser tasks, use the `--slim` mode:
77+
78+
```json
79+
{
80+
"mcpServers": {
81+
"chrome-devtools": {
82+
"command": "npx",
83+
"args": ["-y", "chrome-devtools-mcp@latest", "--slim", "--headless"]
84+
}
85+
}
86+
}
87+
```
88+
89+
See [Slim tool reference](./docs/slim-tool-reference.md).
90+
7691
### MCP Client configuration
7792

7893
<details>
@@ -532,6 +547,10 @@ The Chrome DevTools MCP server supports the following configuration option:
532547
- **Type:** boolean
533548
- **Default:** `true`
534549

550+
- **`--slim`**
551+
Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.
552+
- **Type:** boolean
553+
535554
<!-- END AUTO GENERATED OPTIONS -->
536555

537556
Pass them via the `args` property in the JSON configuration. For example:

docs/slim-tool-reference.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
2+
3+
# Chrome DevTools MCP Slim Tool Reference (~368 cl100k_base tokens)
4+
5+
- **[Navigation automation](#navigation-automation)** (1 tools)
6+
- [`navigate`](#navigate)
7+
- **[Debugging](#debugging)** (2 tools)
8+
- [`evaluate`](#evaluate)
9+
- [`screenshot`](#screenshot)
10+
11+
## Navigation automation
12+
13+
### `navigate`
14+
15+
**Description:** Load URL in the browser
16+
17+
**Parameters:**
18+
19+
- **url** (string) **(required)**: Page URL
20+
21+
---
22+
23+
## Debugging
24+
25+
### `evaluate`
26+
27+
**Description:** [`Evaluate`](#evaluate) a JavaScript function on the last loaded page
28+
29+
**Parameters:**
30+
31+
- **fn** (string) **(required)**: A JavaScript function to be executed on the active page
32+
33+
---
34+
35+
### `screenshot`
36+
37+
**Description:** Take a [`screenshot`](#screenshot) of the active page.
38+
39+
**Parameters:** None
40+
41+
---

scripts/count_tokens.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import {readFileSync} from 'node:fs';
78
import {parseArgs} from 'node:util';
89

910
import {GoogleGenAI} from '@google/genai';
@@ -16,18 +17,28 @@ const {values, positionals} = parseArgs({
1617
type: 'string',
1718
default: 'gemini-2.5-flash',
1819
},
20+
file: {
21+
type: 'string',
22+
short: 'f',
23+
},
1924
},
2025
allowPositionals: true,
2126
});
2227

23-
if (!positionals[0]) {
24-
console.error('Usage: npm run count-tokens -- -- <text>');
28+
let contents = positionals[0];
29+
30+
if (values.file) {
31+
contents = readFileSync(values.file, 'utf8');
32+
}
33+
34+
if (!contents) {
35+
console.error('Usage: npm run count-tokens -- [-f <file>] [<text>]');
2536
process.exit(1);
2637
}
2738

2839
const response = await ai.models.countTokens({
2940
model: values.model,
30-
contents: positionals[0],
41+
contents,
3142
});
32-
console.log(`Input: ${positionals[0]}`);
43+
console.log(`Input: ${values.file || positionals[0]}`);
3344
console.log(`Tokens: ${response.totalTokens}`);

0 commit comments

Comments
 (0)