From 2bb0de1fa8de66bc21b95efd704da9bdc453c912 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 13 Mar 2026 10:16:27 -0700 Subject: [PATCH] fix(readme): add missing tool categories (#1459) Closes #1457 --- README.md | 256 ++++++++++++++++++++++- packages/playwright-mcp/update-readme.js | 32 ++- 2 files changed, 276 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 43743b4..50600c2 100644 --- a/README.md +++ b/README.md @@ -1030,6 +1030,257 @@ http.createServer(async (req, res) => { +
+Configuration (opt-in via --caps=config) + + + +- **browser_get_config** + - Title: Get config + - Description: Get the final resolved config after merging CLI options, environment variables and config file. + - Parameters: None + - Read-only: **true** + +
+ +
+Network (opt-in via --caps=network) + + + +- **browser_route** + - Title: Mock network requests + - Description: Set up a route to mock network requests matching a URL pattern + - Parameters: + - `pattern` (string): URL pattern to match (e.g., "**/api/users", "**/*.{png,jpg}") + - `status` (number, optional): HTTP status code to return (default: 200) + - `body` (string, optional): Response body (text or JSON string) + - `contentType` (string, optional): Content-Type header (e.g., "application/json", "text/html") + - `headers` (array, optional): Headers to add in "Name: Value" format + - `removeHeaders` (string, optional): Comma-separated list of header names to remove from request + - Read-only: **false** + + + +- **browser_route_list** + - Title: List network routes + - Description: List all active network routes + - Parameters: None + - Read-only: **true** + + + +- **browser_unroute** + - Title: Remove network routes + - Description: Remove network routes matching a pattern (or all routes if no pattern specified) + - Parameters: + - `pattern` (string, optional): URL pattern to unroute (omit to remove all routes) + - Read-only: **false** + +
+ +
+Storage (opt-in via --caps=storage) + + + +- **browser_cookie_clear** + - Title: Clear cookies + - Description: Clear all cookies + - Parameters: None + - Read-only: **false** + + + +- **browser_cookie_delete** + - Title: Delete cookie + - Description: Delete a specific cookie + - Parameters: + - `name` (string): Cookie name to delete + - Read-only: **false** + + + +- **browser_cookie_get** + - Title: Get cookie + - Description: Get a specific cookie by name + - Parameters: + - `name` (string): Cookie name to get + - Read-only: **true** + + + +- **browser_cookie_list** + - Title: List cookies + - Description: List all cookies (optionally filtered by domain/path) + - Parameters: + - `domain` (string, optional): Filter cookies by domain + - `path` (string, optional): Filter cookies by path + - Read-only: **true** + + + +- **browser_cookie_set** + - Title: Set cookie + - Description: Set a cookie with optional flags (domain, path, expires, httpOnly, secure, sameSite) + - Parameters: + - `name` (string): Cookie name + - `value` (string): Cookie value + - `domain` (string, optional): Cookie domain + - `path` (string, optional): Cookie path + - `expires` (number, optional): Cookie expiration as Unix timestamp + - `httpOnly` (boolean, optional): Whether the cookie is HTTP only + - `secure` (boolean, optional): Whether the cookie is secure + - `sameSite` (string, optional): Cookie SameSite attribute + - Read-only: **false** + + + +- **browser_localstorage_clear** + - Title: Clear localStorage + - Description: Clear all localStorage + - Parameters: None + - Read-only: **false** + + + +- **browser_localstorage_delete** + - Title: Delete localStorage item + - Description: Delete a localStorage item + - Parameters: + - `key` (string): Key to delete + - Read-only: **false** + + + +- **browser_localstorage_get** + - Title: Get localStorage item + - Description: Get a localStorage item by key + - Parameters: + - `key` (string): Key to get + - Read-only: **true** + + + +- **browser_localstorage_list** + - Title: List localStorage + - Description: List all localStorage key-value pairs + - Parameters: None + - Read-only: **true** + + + +- **browser_localstorage_set** + - Title: Set localStorage item + - Description: Set a localStorage item + - Parameters: + - `key` (string): Key to set + - `value` (string): Value to set + - Read-only: **false** + + + +- **browser_sessionstorage_clear** + - Title: Clear sessionStorage + - Description: Clear all sessionStorage + - Parameters: None + - Read-only: **false** + + + +- **browser_sessionstorage_delete** + - Title: Delete sessionStorage item + - Description: Delete a sessionStorage item + - Parameters: + - `key` (string): Key to delete + - Read-only: **false** + + + +- **browser_sessionstorage_get** + - Title: Get sessionStorage item + - Description: Get a sessionStorage item by key + - Parameters: + - `key` (string): Key to get + - Read-only: **true** + + + +- **browser_sessionstorage_list** + - Title: List sessionStorage + - Description: List all sessionStorage key-value pairs + - Parameters: None + - Read-only: **true** + + + +- **browser_sessionstorage_set** + - Title: Set sessionStorage item + - Description: Set a sessionStorage item + - Parameters: + - `key` (string): Key to set + - `value` (string): Value to set + - Read-only: **false** + + + +- **browser_set_storage_state** + - Title: Restore storage state + - Description: Restore storage state (cookies, local storage) from a file. This clears existing cookies and local storage before restoring. + - Parameters: + - `filename` (string): Path to the storage state file to restore from + - Read-only: **false** + + + +- **browser_storage_state** + - Title: Save storage state + - Description: Save storage state (cookies, local storage) to a file for later reuse + - Parameters: + - `filename` (string, optional): File name to save the storage state to. Defaults to `storage-state-{timestamp}.json` if not specified. + - Read-only: **true** + +
+ +
+DevTools (opt-in via --caps=devtools) + + + +- **browser_start_tracing** + - Title: Start tracing + - Description: Start trace recording + - Parameters: None + - Read-only: **true** + + + +- **browser_start_video** + - Title: Start video + - Description: Start video recording + - Parameters: + - `size` (object, optional): Video size + - Read-only: **true** + + + +- **browser_stop_tracing** + - Title: Stop tracing + - Description: Stop trace recording + - Parameters: None + - Read-only: **true** + + + +- **browser_stop_video** + - Title: Stop video + - Description: Stop video recording + - Parameters: + - `filename` (string, optional): Filename to save the video + - Read-only: **true** + +
+
Coordinate-based (opt-in via --caps=vision) @@ -1166,10 +1417,5 @@ http.createServer(async (req, res) => {
-
-Tracing (opt-in via --caps=tracing) - -
- diff --git a/packages/playwright-mcp/update-readme.js b/packages/playwright-mcp/update-readme.js index b676ff6..786987d 100644 --- a/packages/playwright-mcp/update-readme.js +++ b/packages/playwright-mcp/update-readme.js @@ -22,21 +22,30 @@ const { execSync } = require('child_process'); const { browserTools } = require('playwright/lib/mcp/browser/tools'); -const capabilities = { +const capabilities = /** @type {Record} */ ({ 'core-navigation': 'Core automation', 'core': 'Core automation', 'core-tabs': 'Tab management', 'core-input': 'Core automation', 'core-install': 'Browser installation', - 'vision': 'Coordinate-based (opt-in via --caps=vision)', - 'pdf': 'PDF generation (opt-in via --caps=pdf)', - 'testing': 'Test assertions (opt-in via --caps=testing)', - 'tracing': 'Tracing (opt-in via --caps=tracing)', -}; + 'config': 'Configuration', + 'network': 'Network', + 'storage': 'Storage', + 'devtools': 'DevTools', + 'vision': 'Coordinate-based', + 'pdf': 'PDF generation', + 'testing': 'Test assertions', +}); + +const knownCapabilities = new Set(Object.keys(capabilities)); +const unknownCapabilities = [...new Set(browserTools.map(tool => tool.capability))].filter(cap => !knownCapabilities.has(cap)); +if (unknownCapabilities.length) + throw new Error(`Unknown tool capabilities: ${unknownCapabilities.join(', ')}. Please update the capabilities map in ${path.basename(__filename)}.`); /** @type {Record} */ const toolsByCapability = {}; -for (const [capability, title] of Object.entries(capabilities)) { +for (const capability of Object.keys(capabilities)) { + const title = capabilityTitle(capability); let tools = browserTools.filter(tool => tool.capability === capability && !tool.skillOnly); tools = (toolsByCapability[title] || []).concat(tools); toolsByCapability[title] = tools; @@ -44,6 +53,15 @@ for (const [capability, title] of Object.entries(capabilities)) { for (const [, tools] of Object.entries(toolsByCapability)) tools.sort((a, b) => a.schema.name.localeCompare(b.schema.name)); +/** + * @param {string} capability + * @returns {string} + */ +function capabilityTitle(capability) { + const title = capabilities[capability]; + return capability.startsWith('core') ? title : `${title} (opt-in via --caps=${capability})`; +} + /** * @param {any} tool * @returns {string[]}