Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc080380

Browse files
committed
chore: more detailed route descriptions, ai generated from pptr.dev
1 parenta32f3db commitc080380

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

‎src/mcp/index.ts‎

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
1313
// Register browser automation tools
1414
server.tool(
1515
'browser_open_tab',
16-
'Open a new browser tab',
16+
'Launch a new browser tab with Chrome/Chromium and navigate to a URL. Opens a Puppeteer-controlled page instance that can be automated with other browser commands. Supports both headless (no UI) and headed (visible browser) modes for testing, scraping, and automation tasks.',
1717
{
18-
url:z.string().describe('URL to navigate to'),
19-
headless:z.boolean().optional().describe('Whether to run in headless mode')
18+
url:z.string().describe('URL to navigate to (e.g., https://example.com)'),
19+
headless:z.boolean().optional().describe('Whether to run in headless mode (default: false). Set to true for server environments.')
2020
},
2121
asyncargs=>{
2222
consttabId=awaitbrowserManager.openTab({
@@ -34,7 +34,7 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
3434
}
3535
);
3636

37-
server.tool('browser_list_tabs','List all open browser tabs',{},async()=>{
37+
server.tool('browser_list_tabs','List allcurrentlyopen browser tabs managed by Puppeteer. Returns an array of tab objects with their IDs and metadata. Useful for managing multiple pages, checking what tabs are active, and selecting which tab to interact with.',{},async()=>{
3838
consttabs=awaitbrowserManager.getTabs();
3939
return{
4040
content:[
@@ -48,10 +48,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
4848

4949
server.tool(
5050
'browser_navigate',
51-
'Navigateatab to anew URL',
51+
'Navigatean existing browsertab to adifferent URL. Waits for the page to load completely before returning. Useful for moving between pages in a multi-step automation workflow or testing navigation flows.',
5252
{
53-
tabId:z.string().describe('Tab ID to navigate'),
54-
url:z.string().describe('URL to navigate to')
53+
tabId:z.string().describe('Tab ID to navigate (obtained from browser_open_tab or browser_list_tabs)'),
54+
url:z.string().describe('URL to navigate to (e.g., https://example.com/page)')
5555
},
5656
asyncargs=>{
5757
awaitbrowserManager.navigateTab(args.tabId,args.url);
@@ -68,10 +68,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
6868

6969
server.tool(
7070
'browser_screenshot',
71-
'Take a screenshot of a tab',
71+
'Capture a screenshot of abrowsertab as a PNG image. Can capture either the visible viewport or the entire scrollable page. Returns base64-encoded image data. Perfect for visual testing, documentation, monitoring, or debugging web pages.',
7272
{
7373
tabId:z.string().describe('Tab ID to screenshot'),
74-
fullPage:z.boolean().optional().describe('Whether to capturefullpage')
74+
fullPage:z.boolean().optional().describe('Whether to capturethe entire scrollablepage (true) or just the visible viewport (false, default)')
7575
},
7676
asyncargs=>{
7777
constscreenshot=awaitbrowserManager.screenshotTab(args.tabId,args.fullPage||false);
@@ -88,11 +88,11 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
8888

8989
server.tool(
9090
'browser_click',
91-
'Click an elementin atab',
91+
'Click an elementon aweb page using a CSS selector. Simulates a real mouse click on buttons, links, or any clickable element. Optionally waits for page navigation to complete after clicking, useful for links and form submissions.',
9292
{
9393
tabId:z.string().describe('Tab ID'),
94-
selector:z.string().describe('CSS selector'),
95-
waitForNavigation:z.boolean().optional().describe('Wait for navigationafter click')
94+
selector:z.string().describe('CSS selector to target the element (e.g., "#submit-button", ".menu-item", "button[type=submit]")'),
95+
waitForNavigation:z.boolean().optional().describe('Wait for navigation/page loadafter click (default: false). Set to true for links and form submissions.')
9696
},
9797
asyncargs=>{
9898
awaitbrowserManager.clickElement(args.tabId,args.selector,args.waitForNavigation||false);
@@ -109,10 +109,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
109109

110110
server.tool(
111111
'browser_hover',
112-
'Hoverover an elementin a tab',
112+
'Move the mouse cursorover an elementto trigger hover effects. Useful for testing dropdown menus, tooltips, or any hover-triggered UI elements. Simulates the mouseover event just like a real user hovering with their mouse.',
113113
{
114114
tabId:z.string().describe('Tab ID'),
115-
selector:z.string().describe('CSS selector')
115+
selector:z.string().describe('CSS selector of the element to hover over (e.g., ".dropdown-trigger", "#menu-item")')
116116
},
117117
asyncargs=>{
118118
awaitbrowserManager.hoverElement(args.tabId,args.selector);
@@ -129,11 +129,11 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
129129

130130
server.tool(
131131
'browser_fill_form',
132-
'Fill a formfieldin a tab',
132+
'Type text into an inputfieldor textarea on a web page. Clears existing content and fills the field with the specified value. Works with text inputs, password fields, search boxes, textareas, and other text entry elements. Essential for form automation and testing.',
133133
{
134134
tabId:z.string().describe('Tab ID'),
135-
selector:z.string().describe('CSS selector'),
136-
value:z.string().describe('Valuetofill')
135+
selector:z.string().describe('CSS selector of the input field (e.g., "input[name=username]", "#email", "textarea.description")'),
136+
value:z.string().describe('Text valuetotype into the field')
137137
},
138138
asyncargs=>{
139139
awaitbrowserManager.fillField(args.tabId,args.selector,args.value);
@@ -150,11 +150,11 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
150150

151151
server.tool(
152152
'browser_select_option',
153-
'Select an optionin a dropdown',
153+
'Select an optionfrom a dropdown menu (<select> element). Chooses an option by its value attribute. Triggers change events as if a user selected the option manually. Perfect for automated form filling and testing select dropdowns.',
154154
{
155155
tabId:z.string().describe('Tab ID'),
156-
selector:z.string().describe('CSS selector'),
157-
value:z.string().describe('Option valueto select')
156+
selector:z.string().describe('CSS selector of the <select> element (e.g., "select[name=country]", "#category-dropdown")'),
157+
value:z.string().describe('Value attribute of the <option>to select (not the visible text)')
158158
},
159159
asyncargs=>{
160160
awaitbrowserManager.selectOption(args.tabId,args.selector,args.value);
@@ -171,10 +171,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
171171

172172
server.tool(
173173
'browser_eval_js',
174-
'Execute JavaScript ina tab',
174+
'ExecutecustomJavaScriptcodeinthe context of a web page and return the result. Runs in the page\'s JavaScript environment with access to the DOM, window object, and page variables. Use for extracting data, manipulating page content, or calling page functions. Returns serializable values (strings, numbers, objects, arrays).',
175175
{
176176
tabId:z.string().describe('Tab ID'),
177-
script:z.string().describe('JavaScript code to execute')
177+
script:z.string().describe('JavaScript code to execute (e.g., "document.title", "window.scrollTo(0, 100)", "Array.from(document.querySelectorAll(\'a\')).map(a => a.href)")')
178178
},
179179
asyncargs=>{
180180
constresult=awaitbrowserManager.evaluateScript(args.tabId,args.script);
@@ -191,9 +191,9 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
191191

192192
server.tool(
193193
'browser_close_tab',
194-
'Close a browser tab',
194+
'Closeand cleanupa browser tab. Closes the Puppeteer page instance and releases associated resources. Use when finished with a tab to free up memory and browser resources.',
195195
{
196-
tabId:z.string().describe('Tab ID to close')
196+
tabId:z.string().describe('Tab ID to close (obtained from browser_open_tab or browser_list_tabs)')
197197
},
198198
asyncargs=>{
199199
awaitbrowserManager.closeTab(args.tabId);
@@ -210,9 +210,9 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
210210

211211
server.tool(
212212
'browser_bring_to_front',
213-
'Bring atab to thefront',
213+
'Activate and bring a browsertab to theforeground. Makes the specified tab the active tab in the browser window, similar to clicking on a browser tab. Useful when working with multiple tabs in headed mode.',
214214
{
215-
tabId:z.string().describe('Tab ID')
215+
tabId:z.string().describe('Tab ID to bring to front')
216216
},
217217
asyncargs=>{
218218
awaitbrowserManager.bringToFront(args.tabId);
@@ -229,10 +229,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
229229

230230
server.tool(
231231
'browser_focus_element',
232-
'Focusonanelementin a tab',
232+
'Set keyboard focusona specificelementon the page. Triggers focus events and prepares the element to receive keyboard input. Commonly used before typing into fields, testing keyboard navigation, or triggering focus-dependent behaviors.',
233233
{
234234
tabId:z.string().describe('Tab ID'),
235-
selector:z.string().describe('CSS selector of element to focus')
235+
selector:z.string().describe('CSS selector oftheelement to focus (e.g., "input[name=search]", "#comment-box")')
236236
},
237237
asyncargs=>{
238238
awaitbrowserManager.focusElement(args.tabId,args.selector);
@@ -249,7 +249,7 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
249249

250250
server.tool(
251251
'browser_go_back',
252-
'Navigateback in browser history',
252+
'Navigatebackward inthebrowser history, equivalent to clicking the back button. Goes to the previous page in the tab\'s navigation history. Useful for testing navigation flows or returning to previous pages in multi-step processes.',
253253
{
254254
tabId:z.string().describe('Tab ID')
255255
},
@@ -268,7 +268,7 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
268268

269269
server.tool(
270270
'browser_go_forward',
271-
'Navigate forward in browser history',
271+
'Navigate forward inthebrowser history, equivalent to clicking the forward button. Goes to the next page in the tab\'s navigation history after going back. Only works if you\'ve previously navigated backward.',
272272
{
273273
tabId:z.string().describe('Tab ID')
274274
},
@@ -287,10 +287,10 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
287287

288288
server.tool(
289289
'browser_reload',
290-
'Reload a tab',
290+
'Reloadthe current page ina tab, equivalent to pressing F5 or clicking the refresh button. Refreshes all page content and re-executes scripts. Optionally specify when to consider the reload complete (e.g., wait for network to be idle or just the load event).',
291291
{
292292
tabId:z.string().describe('Tab ID'),
293-
waitUntil:z.string().optional().describe('When to consider navigation complete (networkidle2, load, etc.)')
293+
waitUntil:z.string().optional().describe('When to consider navigation complete: "load" (default), "domcontentloaded", "networkidle0" (no network connections for 500ms), or "networkidle2" (max 2 network connections for 500ms)')
294294
},
295295
asyncargs=>{
296296
awaitbrowserManager.reloadTab(args.tabId,args.waitUntil);
@@ -307,12 +307,12 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
307307

308308
server.tool(
309309
'browser_wait_for_selector',
310-
'Wait foraselector to appear ina tab',
310+
'Wait foran element matching a CSSselector to appear inthe DOM. Pauses execution until the element is found or timeout is reached. Optionally wait for the element to be visible (not just present in DOM). Essential for handling dynamic content, SPAs, and elements loaded via JavaScript.',
311311
{
312312
tabId:z.string().describe('Tab ID'),
313-
selector:z.string().describe('CSS selector to wait for'),
314-
timeout:z.number().optional().describe('Timeoutin milliseconds'),
315-
visible:z.boolean().optional().describe('Wait for element to be visible')
313+
selector:z.string().describe('CSS selector to wait for (e.g., ".loading-complete", "#dynamic-content")'),
314+
timeout:z.number().optional().describe('Maximum time to waitin milliseconds (default: 30000)'),
315+
visible:z.boolean().optional().describe('Wait for element to be visible, not just present in DOM (default: false)')
316316
},
317317
asyncargs=>{
318318
constoptions:any={};
@@ -332,11 +332,11 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
332332

333333
server.tool(
334334
'browser_wait_for_function',
335-
'Wait for a function to return truthy value',
335+
'Wait for acustom JavaScriptfunction to returnatruthy value. Repeatedly evaluates the provided function in the page context until it returns true or timeout is reached. More flexible than wait_for_selector - use for waiting on custom conditions like variable values, element counts, or complex page states.',
336336
{
337337
tabId:z.string().describe('Tab ID'),
338-
functionScript:z.string().describe('JavaScript function towait for'),
339-
timeout:z.number().optional().describe('Timeoutin milliseconds')
338+
functionScript:z.string().describe('JavaScript function/expression toevaluate repeatedly (e.g., "() => document.querySelectorAll(\'.item\').length > 5", "() => window.dataLoaded === true")'),
339+
timeout:z.number().optional().describe('Maximum time to waitin milliseconds (default: 30000)')
340340
},
341341
asyncargs=>{
342342
constoptions:any={};
@@ -355,11 +355,11 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
355355

356356
server.tool(
357357
'browser_wait_for_navigation',
358-
'Wait for navigation to complete',
358+
'Wait fora pagenavigationeventto complete. Waits for the page to finish loading after actions that trigger navigation (like clicking links or submitting forms). Specify different completion criteria based on your needs - wait for initial load or for network to become idle.',
359359
{
360360
tabId:z.string().describe('Tab ID'),
361-
timeout:z.number().optional().describe('Timeoutin milliseconds'),
362-
waitUntil:z.string().optional().describe('When to consider navigation complete (networkidle2, load, etc.)')
361+
timeout:z.number().optional().describe('Maximum time to waitin milliseconds (default: 30000)'),
362+
waitUntil:z.string().optional().describe('When to consider navigation complete: "load" (default), "domcontentloaded", "networkidle0", or "networkidle2"')
363363
},
364364
asyncargs=>{
365365
constoptions:any={};
@@ -379,7 +379,7 @@ export function initializeMcpServer(chromePath?: string | null): McpServer {
379379

380380
server.tool(
381381
'browser_get_url',
382-
'Get the current URL of a tab',
382+
'Get the current URL of abrowsertab. Returns the complete URL currently loaded in the tab, including any changes from navigation, redirects, or hash/query parameter updates. Useful for verifying navigation, checking redirects, or tracking page state.',
383383
{
384384
tabId:z.string().describe('Tab ID')
385385
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp