Skip to main content
Glama

pilot_close

Close the browser instance and release resources to end the browsing session or prepare for a new one.

Instructions

Close the browser instance and release all associated resources. Use when the user wants to end the browsing session, clean up after completing a task, or start fresh with a new browser session.

Parameters: (none)

Returns: Confirmation that the browser was closed.

Errors:

  • "No browser to close": No browser session is currently running. Safe to ignore.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'pilot_close' tool via server.tool() with empty schema and handler that calls bm.close().
      server.tool(
        'pilot_close',
        `Close the browser instance and release all associated resources.
    Use when the user wants to end the browsing session, clean up after completing a task, or start fresh with a new browser session.
    
    Parameters: (none)
    
    Returns: Confirmation that the browser was closed.
    
    Errors:
    - "No browser to close": No browser session is currently running. Safe to ignore.`,
        {},
        async () => {
          try {
            await bm.close();
            return { content: [{ type: 'text' as const, text: 'Browser closed.' }] };
          } catch (err) {
            return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
          }
        }
      );
  • Handler function for 'pilot_close': calls bm.close() and returns 'Browser closed.' or wraps errors.
      async () => {
        try {
          await bm.close();
          return { content: [{ type: 'text' as const, text: 'Browser closed.' }] };
        } catch (err) {
          return { content: [{ type: 'text' as const, text: wrapError(err) }], isError: true };
        }
      }
    );
  • Empty schema object for 'pilot_close' (no parameters).
    {},
  • registerAllTools calls registerSettingsTools which registers pilot_close.
    export function registerAllTools(server: McpServer, bm: BrowserManager, profile: ToolProfile = 'full'): void {
      const allowed = PROFILE_TOOLS[profile];
      const effectiveServer = allowed ? createFilteredServer(server, allowed) : server;
    
      registerNavigationTools(effectiveServer, bm);
      registerSnapshotTools(effectiveServer, bm);
      registerInteractionTools(effectiveServer, bm);
      registerPageTools(effectiveServer, bm);
      registerInspectionTools(effectiveServer, bm);
      registerVisualTools(effectiveServer, bm);
      registerTabTools(effectiveServer, bm);
      registerSettingsTools(effectiveServer, bm);
      registerIframeTools(effectiveServer, bm);
      registerAutomationTools(effectiveServer, bm);
    }
  • wrapError helper used by the pilot_close handler to format error messages.
    export function wrapError(err: any): string {
      const msg = err.message || String(err);
    
      // Timeout errors
      if (err.name === 'TimeoutError' || msg.includes('Timeout') || msg.includes('timeout')) {
        if (msg.includes('locator.click') || msg.includes('locator.fill') || msg.includes('locator.hover')) {
          return 'Element not found or not interactable within timeout. Check your selector or run pilot_snapshot for fresh refs.';
        }
        if (msg.includes('page.goto') || msg.includes('Navigation')) {
          return 'Page navigation timed out. The URL may be unreachable or the page may be loading slowly.';
Behavior4/5

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

No annotations, so description carries full burden. Discloses resource release and error condition 'No browser to close' as safe to ignore. Does not elaborate on irreversibility or impact on other windows, but for a close operation it is adequate.

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?

Description is short, front-loaded with the primary action, and includes use cases, parameter list, return value, and error handling. Every sentence is useful and none are redundant.

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

Completeness5/5

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

For a simple tool with no parameters, the description covers purpose, usage, return type, and errors. No output schema exists, but the stated return ('Confirmation') is sufficient.

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

Parameters3/5

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

No parameters in schema, description simply states 'Parameters: (none)'. This adds no significant meaning beyond the schema, but for zero-parameter tools a baseline of 3 applies.

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?

Description clearly states 'Close the browser instance and release all associated resources.' The verb 'close' and resource 'browser instance' are specific. It distinguishes itself from sibling pilot_tab_close by referring to the entire browser.

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?

Explicitly states when to use: 'when the user wants to end the browsing session, clean up after completing a task, or start fresh with a new browser session.' Does not mention alternatives, but context implies not for tab-level closing.

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/TacosyHorchata/Pilot'

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