Skip to main content
Glama

camofox_close_session

Close all browser tabs for a user session to complete cleanup. Provide any tab ID from the session to identify the user.

Instructions

Close all browser tabs for a user session. Use for complete cleanup when done with a browsing session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdYesAny tab ID from the session to identify the user

Implementation Reference

  • The tool 'camofox_close_session' is registered via server.tool() with schema (tabId: z.string()) and handler logic.
    server.tool(
      "camofox_close_session",
      "Close all browser tabs for a user session. Use for complete cleanup when done with a browsing session.",
      {
        tabId: z.string().describe("Any tab ID from the session to identify the user")
      },
      async (input: unknown) => {
        try {
          const parsed = z
            .object({
              tabId: z.string().describe("Any tab ID from the session to identify the user")
            })
            .parse(input);
          const tracked = getTrackedTab(parsed.tabId);
    
          let autoSaved = false;
          // Auto-save before session close (best-effort; never blocks close)
          if (deps.config.autoSave) {
            const saved = await withAutoTimeout(
              (async () => {
                const allTabs = getAllTrackedTabs().filter((t) => t.userId === tracked.userId);
                const tabForExport = allTabs.find((t) => t.tabId === parsed.tabId) ?? allTabs[0];
                if (!tabForExport) {
                  return false;
                }
    
                const cookies = await deps.client.exportCookies(tabForExport.tabId, tracked.userId);
                if (cookies.length <= 0) {
                  return false;
                }
    
                const autoProfileId = `_auto_${tracked.userId}`;
                await saveProfile(deps.config.profilesDir, autoProfileId, tracked.userId, cookies, {
                  description: "Auto-saved session",
                  lastUrl: tabForExport.url
                });
                return true;
              })(),
              AUTO_PROFILE_TIMEOUT_MS
            );
            autoSaved = saved.ok ? saved.value : false;
          }
    
          try {
            await deps.client.closeSession(tracked.userId);
          } finally {
            clearTrackedTabsByUserId(tracked.userId);
          }
          return okResult({
            message: `Session closed. All tabs for user ${tracked.userId} have been released.`,
            autoSaved
          });
        } catch (error) {
          return toErrorResult(error);
        }
      }
    );
  • The tool name 'camofox_close_session' is defined as a string literal.
    "camofox_close_session",
  • Input schema: tabId (z.string()) is the only required parameter. No output schema defined besides the return result.
    {
      tabId: z.string().describe("Any tab ID from the session to identify the user")
    },
  • The handler function: looks up tracked tab by tabId, optionally auto-saves cookies to a profile, calls deps.client.closeSession(tracked.userId), then clears tracked tabs by userId. Returns success message or error.
    async (input: unknown) => {
      try {
        const parsed = z
          .object({
            tabId: z.string().describe("Any tab ID from the session to identify the user")
          })
          .parse(input);
        const tracked = getTrackedTab(parsed.tabId);
    
        let autoSaved = false;
        // Auto-save before session close (best-effort; never blocks close)
        if (deps.config.autoSave) {
          const saved = await withAutoTimeout(
            (async () => {
              const allTabs = getAllTrackedTabs().filter((t) => t.userId === tracked.userId);
              const tabForExport = allTabs.find((t) => t.tabId === parsed.tabId) ?? allTabs[0];
              if (!tabForExport) {
                return false;
              }
    
              const cookies = await deps.client.exportCookies(tabForExport.tabId, tracked.userId);
              if (cookies.length <= 0) {
                return false;
              }
    
              const autoProfileId = `_auto_${tracked.userId}`;
              await saveProfile(deps.config.profilesDir, autoProfileId, tracked.userId, cookies, {
                description: "Auto-saved session",
                lastUrl: tabForExport.url
              });
              return true;
            })(),
            AUTO_PROFILE_TIMEOUT_MS
          );
          autoSaved = saved.ok ? saved.value : false;
        }
    
        try {
          await deps.client.closeSession(tracked.userId);
        } finally {
          clearTrackedTabsByUserId(tracked.userId);
        }
        return okResult({
          message: `Session closed. All tabs for user ${tracked.userId} have been released.`,
          autoSaved
        });
      } catch (error) {
        return toErrorResult(error);
      }
    }
Behavior4/5

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

Despite no annotations, the description discloses the destructive nature of the tool (closing all tabs) and its scope. It is sufficient for a simple operation, though it could mention potential side effects like loss of unsaved state.

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?

Two concise sentences with no unnecessary words. The first sentence states the action, the second provides usage context. Ideal length.

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 tool with one parameter and no output schema, the description fully explains what it does, when to use it, and how to identify the session. No gaps remain.

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 coverage is 100% with a single required parameter. The description adds that tabId identifies the user, which is already implied by the schema description. Baseline score of 3 is appropriate as no additional semantics provided.

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 all browser tabs for a user session') and the resource it acts on. It distinguishes itself from 'close_tab' by specifying 'all tabs' and 'complete cleanup'.

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?

Provides explicit usage guidance: 'Use for complete cleanup when done with a browsing session.' While it doesn't list when not to use, the context implies that for closing a single tab, 'close_tab' is the alternative.

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/redf0x1/camofox-mcp'

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