mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-09-14 19:45:30 +08:00
docs: remove token estimates (#2003)
since we include conditional tools in the reference, we cannot give exact estimates since they depend on the configuration.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->
|
||||
|
||||
# Chrome DevTools MCP Slim Tool Reference (~359 cl100k_base tokens)
|
||||
# Chrome DevTools MCP Slim Tool Reference
|
||||
|
||||
- **[Navigation automation](#navigation-automation)** (1 tools)
|
||||
- [`navigate`](#navigate)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->
|
||||
|
||||
# Chrome DevTools MCP Tool Reference (~7010 cl100k_base tokens)
|
||||
# Chrome DevTools MCP Tool Reference
|
||||
|
||||
- **[Input automation](#input-automation)** (10 tools)
|
||||
- [`click`](#click)
|
||||
|
||||
Generated
-8
@@ -43,7 +43,6 @@
|
||||
"rollup-plugin-license": "^3.6.0",
|
||||
"semver": "^7.7.4",
|
||||
"sinon": "^21.0.0",
|
||||
"tiktoken": "^1.0.22",
|
||||
"typescript": "^6.0.2",
|
||||
"typescript-eslint": "^8.43.0",
|
||||
"urlpattern-polyfill": "^10.1.0",
|
||||
@@ -8660,13 +8659,6 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tiktoken": {
|
||||
"version": "1.0.22",
|
||||
"resolved": "https://registry.npmjs.org/tiktoken/-/tiktoken-1.0.22.tgz",
|
||||
"integrity": "sha512-PKvy1rVF1RibfF3JlXBSP0Jrcw2uq3yXdgcEXtKTYn3QJ/cBRBHDnrJ5jHky+MENZ6DIPwNUGWpkVx+7joCpNA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.15",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
"rollup-plugin-license": "^3.6.0",
|
||||
"semver": "^7.7.4",
|
||||
"sinon": "^21.0.0",
|
||||
"tiktoken": "^1.0.22",
|
||||
"typescript": "^6.0.2",
|
||||
"typescript-eslint": "^8.43.0",
|
||||
"urlpattern-polyfill": "^10.1.0",
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
|
||||
import fs from 'node:fs';
|
||||
|
||||
import {Client} from '@modelcontextprotocol/sdk/client/index.js';
|
||||
import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
import type {Tool} from '@modelcontextprotocol/sdk/types.js';
|
||||
import {get_encoding} from 'tiktoken';
|
||||
|
||||
import {cliOptions} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
|
||||
import type {ParsedArguments} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
|
||||
@@ -25,42 +22,6 @@ const OUTPUT_PATH = './docs/tool-reference.md';
|
||||
const SLIM_OUTPUT_PATH = './docs/slim-tool-reference.md';
|
||||
const README_PATH = './README.md';
|
||||
|
||||
async function measureServer(args: string[]) {
|
||||
// 1. Connect to your actual MCP server
|
||||
const transport = new StdioClientTransport({
|
||||
command: 'node',
|
||||
args: ['./build/src/bin/chrome-devtools-mcp.js', ...args], // Point to your built MCP server
|
||||
});
|
||||
|
||||
const client = new Client(
|
||||
{name: 'measurer', version: '1.0.0'},
|
||||
{capabilities: {}},
|
||||
);
|
||||
await client.connect(transport);
|
||||
|
||||
// 2. Fetch all tools
|
||||
const toolsList = await client.listTools();
|
||||
|
||||
// 3. Serialize exactly how an LLM would see it (JSON)
|
||||
const jsonString = JSON.stringify(toolsList.tools, null, 2);
|
||||
|
||||
// 4. Count tokens (using cl100k_base which is standard for GPT-4/Claude-3.5 approximation)
|
||||
const enc = get_encoding('cl100k_base');
|
||||
const tokenCount = enc.encode(jsonString).length;
|
||||
|
||||
console.log(`--- Measurement Results ---`);
|
||||
console.log(`Total Tools: ${toolsList.tools.length}`);
|
||||
console.log(`JSON Character Count: ${jsonString.length}`);
|
||||
console.log(`Estimated Token Count: ~${tokenCount}`);
|
||||
|
||||
// Clean up
|
||||
enc.free();
|
||||
await client.close();
|
||||
return {
|
||||
tokenCount,
|
||||
};
|
||||
}
|
||||
|
||||
// Extend the MCP Tool type to include our annotations
|
||||
interface ToolWithAnnotations extends Tool {
|
||||
annotations?: {
|
||||
@@ -337,14 +298,13 @@ async function generateReference(
|
||||
toolsWithAnnotations: ToolWithAnnotations[],
|
||||
categories: Record<string, ToolWithAnnotations[]>,
|
||||
sortedCategories: string[],
|
||||
serverArgs: string[],
|
||||
) {
|
||||
console.log(`Found ${toolsWithAnnotations.length} tools`);
|
||||
|
||||
// Generate markdown documentation
|
||||
let markdown = `<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->
|
||||
|
||||
# ${title} (~${(await measureServer(serverArgs)).tokenCount} cl100k_base tokens)
|
||||
# ${title}
|
||||
|
||||
`;
|
||||
// Generate table of contents
|
||||
@@ -567,7 +527,6 @@ async function generateToolDocumentation(): Promise<void> {
|
||||
toolsWithAnnotations,
|
||||
categories,
|
||||
sortedCategories,
|
||||
[],
|
||||
);
|
||||
|
||||
// Generate tools TOC and update README
|
||||
@@ -584,7 +543,6 @@ async function generateToolDocumentation(): Promise<void> {
|
||||
toolsWithAnnotations,
|
||||
categories,
|
||||
sortedCategories,
|
||||
['--slim'],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user