Skip to main content
Glama

interceptor_browser_close

Close a browser instance launched for proxy interception. Requires the target ID from the browser launch command.

Instructions

Close a browser instance launched by interceptor_browser_launch (or interceptor_camoufox_launch).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idYesTarget ID from interceptor_browser_launch or interceptor_camoufox_launch

Implementation Reference

  • BrowserInterceptor.deactivate() — closes browser context and browser, removes entry from launched map
    async deactivate(targetId: string): Promise<void> {
      const entry = this.launched.get(targetId);
      if (!entry) {
        throw new Error(`No browser instance with target ID '${targetId}'`);
      }
    
      try { await entry.context.close(); } catch { /* best effort */ }
      try { await entry.browser.close(); } catch { /* already gone */ }
    
      this.launched.delete(targetId);
    }
  • MCP tool registration for 'interceptor_browser_close' with schema (target_id) and handler that delegates to interceptorManager.deactivate()
    server.tool(
      "interceptor_browser_close",
      "Close a browser instance launched by interceptor_browser_launch (or interceptor_camoufox_launch).",
      {
        target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
      },
      async ({ target_id }) => {
        try {
          const interceptorId = typeof target_id === "string" && target_id.startsWith("camoufox_")
            ? "camoufox"
            : "browser";
          await interceptorManager.deactivate(interceptorId, target_id);
          return {
            content: [{
              type: "text",
              text: JSON.stringify({ status: "success", message: `Browser instance ${target_id} closed.` }),
            }],
          };
        } catch (e) {
          return { content: [{ type: "text", text: JSON.stringify({ status: "error", error: errorToString(e) }) }] };
        }
      },
    );
  • InterceptorManager.deactivate() — resolves interceptor by ID and calls its deactivate(targetId)
      /** Deactivate a specific target on a specific interceptor. */
      async deactivate(interceptorId: string, targetId: string): Promise<void> {
        const interceptor = this.interceptors.get(interceptorId);
        if (!interceptor) {
          throw new Error(`Interceptor '${interceptorId}' not found.`);
        }
        await interceptor.deactivate(targetId);
      }
    
      /** Deactivate ALL targets on ALL interceptors. Called during proxy shutdown. */
      async deactivateAll(): Promise<void> {
        const errors: string[] = [];
        for (const interceptor of this.interceptors.values()) {
          try {
            await interceptor.deactivateAll();
          } catch (e) {
            errors.push(`${interceptor.id}: ${e}`);
          }
        }
        if (errors.length > 0) {
          throw new Error(`Errors during deactivateAll: ${errors.join("; ")}`);
        }
      }
    }
    
    /** Singleton instance. */
    export const interceptorManager = new InterceptorManager();
  • Zod schema for target_id input parameter (string)
    {
      target_id: z.string().describe("Target ID from interceptor_browser_launch or interceptor_camoufox_launch"),
    },
  • Interceptor interface defining the deactivate(targetId) contract
      /**
       * Deactivate a specific target by ID.
       */
      deactivate(targetId: string): Promise<void>;
    
      /**
       * Deactivate all active targets. Called during proxy shutdown.
       */
      deactivateAll(): Promise<void>;
    
      /**
       * Get metadata for display: availability, active targets.
       */
      getMetadata(): Promise<InterceptorMetadata>;
    }
Behavior3/5

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

No annotations provided, so description must cover behavior. It conveys closure action but does not detail side effects (e.g., termination, state loss). Basic but adequate.

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

Conciseness4/5

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

Efficient single sentence with no wasted words. Could be slightly expanded for context, but remains concise and front-loaded.

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

Completeness4/5

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

For a simple close operation, description is adequate: action, resource, parameter source. Lacks error handling info but matches low complexity.

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?

Schema already fully describes the parameter with 100% coverage. Description reinforces the source of target_id but adds limited value beyond schema.

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 the action (close) and resource (browser instance), and specifies the launching tools, distinguishing it from siblings like interceptor_browser_launch.

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

Usage Guidelines3/5

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

Implicitly indicates usage after launching a browser, but lacks explicit guidance on when not to use or alternatives (e.g., interceptor_camoufox_close).

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/yfe404/proxy-mcp'

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