Skip to main content
Glama
b3nw
by b3nw

Refresh Current Page

browser_refresh

Refresh the current web page to reload content and resolve display issues, with options to wait for specific load states before proceeding.

Instructions

Refresh the current page, similar to pressing F5 or clicking browser refresh

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
waitUntilNoload
timeoutNo

Implementation Reference

  • Handler function that refreshes the current browser page using page.reload() with optional waitUntil and timeout parameters, reports new URL and any redirects.
    async (params: any) => {
      try {
        const input = z.object({
          waitUntil: z.enum(['networkidle', 'domcontentloaded', 'load']).optional().default('load'),
          timeout: z.number().optional()
        }).parse(params);
        await this.playwright.ensureConnected();
        
        const page = this.playwright.getPage();
        
        // Get current URL before refresh
        const currentUrl = page.url();
        
        // Perform the refresh with specified options
        const refreshOptions: any = {
          waitUntil: input.waitUntil
        };
        
        if (input.timeout !== undefined) {
          refreshOptions.timeout = input.timeout;
        }
        
        await page.reload(refreshOptions);
        
        // Get URL after refresh (should be the same unless redirected)
        const newUrl = page.url();
        
        return {
          content: [{
            type: 'text',
            text: `Successfully refreshed page. URL: ${newUrl}${currentUrl !== newUrl ? ` (redirected from ${currentUrl})` : ''}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Page refresh failed: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • Zod input schema definition for the browser_refresh tool, defining optional waitUntil and timeout parameters.
    export const BrowserRefreshInputSchema = z.object({
      waitUntil: z.enum(['networkidle', 'domcontentloaded', 'load']).optional().default('load'),
      timeout: z.number().optional()
    });
  • src/server.ts:559-612 (registration)
    Registration of the browser_refresh tool using this.server.registerTool, including inline schema and handler function.
    this.server.registerTool(
      'browser_refresh',
      {
        title: 'Refresh Current Page',
        description: 'Refresh the current page, similar to pressing F5 or clicking browser refresh',
        inputSchema: {
          waitUntil: z.enum(['networkidle', 'domcontentloaded', 'load']).optional().default('load'),
          timeout: z.number().optional()
        }
      },
      async (params: any) => {
        try {
          const input = z.object({
            waitUntil: z.enum(['networkidle', 'domcontentloaded', 'load']).optional().default('load'),
            timeout: z.number().optional()
          }).parse(params);
          await this.playwright.ensureConnected();
          
          const page = this.playwright.getPage();
          
          // Get current URL before refresh
          const currentUrl = page.url();
          
          // Perform the refresh with specified options
          const refreshOptions: any = {
            waitUntil: input.waitUntil
          };
          
          if (input.timeout !== undefined) {
            refreshOptions.timeout = input.timeout;
          }
          
          await page.reload(refreshOptions);
          
          // Get URL after refresh (should be the same unless redirected)
          const newUrl = page.url();
          
          return {
            content: [{
              type: 'text',
              text: `Successfully refreshed page. URL: ${newUrl}${currentUrl !== newUrl ? ` (redirected from ${currentUrl})` : ''}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Page refresh failed: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the refresh action, it doesn't describe what happens during refresh (page reload, network requests, potential loss of form data), whether it waits for page load completion, or any error conditions. The analogy helps but lacks operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise - a single sentence that communicates the core purpose efficiently with a helpful analogy. Every word earns its place, and it's front-loaded with the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a browser interaction tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is insufficient. It doesn't explain parameter usage, behavioral details, or what happens after refresh. The analogy helps but doesn't compensate for the missing operational context needed for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and 2 parameters, the description provides no information about the 'waitUntil' enum parameter or 'timeout' parameter. The schema defines these parameters but the description doesn't explain what they control or when to use different waitUntil values, leaving significant gaps in understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('refresh') and resource ('current page'), and distinguishes it from siblings by specifying the browser context. It uses a helpful analogy ('similar to pressing F5 or clicking browser refresh') that makes the purpose immediately understandable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (to refresh the current browser page), but doesn't explicitly state when NOT to use it or mention alternatives like browser_navigate for different navigation actions. The browser context is implied but not contrasted with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/b3nw/playwright-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server