Skip to main content
Glama
FutureAtoms

Agentic Control Framework (ACF)

by FutureAtoms

browser_tab_close

Close the currently active browser tab.

Instructions

browser tab close

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function 'browserTabClose' that closes a browser tab. If no index is specified, it closes the current tab (using the module-level `page` variable). If an index is given, it validates the index and closes the tab at that index from `context.pages()`. It also handles switching to another tab if the closed tab was the current one. Returns success/error messages.
    async function browserTabClose(index) {
      try {
        const browser = await getBrowser();
        const pages = context ? context.pages() : [];
    
        // If no index specified, close current tab
        if (index === undefined) {
          if (page && !page.isClosed()) {
            await page.close();
            
            // Switch to another tab if available
            const remainingPages = context.pages();
            if (remainingPages.length > 0) {
              page = remainingPages[remainingPages.length - 1];
            } else {
              page = null;
            }
            
            return {
              success: true,
              message: 'Current tab closed'
            };
          }
        } else {
          // Close tab by index
          if (index < 0 || index >= pages.length) {
            return {
              success: false,
              message: `Invalid tab index: ${index}`
            };
          }
    
          await pages[index].close();
          
          // If we closed the current page, switch to another
          if (pages[index] === page) {
            const remainingPages = context.pages();
            if (remainingPages.length > 0) {
              page = remainingPages[Math.min(index, remainingPages.length - 1)];
            } else {
              page = null;
            }
          }
    
          return {
            success: true,
            message: `Tab ${index} closed`
          };
        }
    
      } catch (error) {
        logger.error(`Error closing tab: ${error.message}`);
        return {
          success: false,
          message: error.message
        };
      }
    }
  • Registration of 'browser_tab_close' as an MCP tool. It is added to the 'browserExtras' array with its name, and registered with a simple input schema (empty properties) during the 'tools/list' handler.
    const browserExtras = [
      { n:'browser_navigate_back' }, { n:'browser_navigate_forward' }, { n:'browser_hover' }, { n:'browser_drag' },
      { n:'browser_select_option' }, { n:'browser_press_key' }, { n:'browser_snapshot' }, { n:'browser_console_messages' },
      { n:'browser_network_requests' }, { n:'browser_tab_list' }, { n:'browser_tab_new' }, { n:'browser_tab_select' },
      { n:'browser_tab_close' }, { n:'browser_file_upload' }, { n:'browser_wait' }, { n:'browser_wait_for' },
      { n:'browser_resize' }, { n:'browser_handle_dialog' }
    ];
    for (const b of browserExtras) {
      tools.push({ name: b.n, description: b.n.replace(/_/g,' '), inputSchema: { type:'object', properties:{} } });
    }
  • Dispatch call in the 'tools/call' handler that invokes browserTools.browserTabClose(args.index) when the tool name is 'browser_tab_close'.
    case 'browser_tab_close': data = await browserTools.browserTabClose(args.index); break;
  • Export of the browserTabClose function as part of the module's exports, under the 'Tab management' section.
    // Tab management
    browserTabList,
    browserTabNew,
    browserTabSelect,
    browserTabClose,
Behavior1/5

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

No behavioral details disclosed: no info on confirmation, unsaved data handling, or whether it closes the active tab or requires a tab ID. No annotations to supplement.

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

Conciseness2/5

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

Extremely concise but under-specified; single sentence is too short to be useful.

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

Completeness1/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 params and no output schema, the description is critically incomplete; lacks details on which tab is closed and any side effects.

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 no parameters, 100% schema coverage, but the description adds no meaning beyond the schema baseline of 4. It fails to clarify what tab is closed.

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

Purpose1/5

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

The description 'browser tab close' is a tautology, restating the tool name without adding specificity about what 'close' entails.

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

Usage Guidelines1/5

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

No usage guidance provided; no mention of when to use this tool versus alternatives like browser_tab_select or browser_navigate.

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/FutureAtoms/agentic-control-framework'

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