Skip to main content
Glama
lxman

Safari MCP Server

by lxman

safari_clear_network_logs

Clear captured network logs for a specific Safari browser session to manage monitoring data and maintain privacy.

Instructions

Clear captured network logs for a session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • Registers the 'safari_clear_network_logs' tool in the MCP tools list, including its name, description, and input schema requiring 'sessionId'.
    {
      name: 'safari_clear_network_logs',
      description: 'Clear captured network logs for a session',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'Session identifier' }
        },
        required: ['sessionId']
      }
    },
  • Switch case in handleToolCall that dispatches 'safari_clear_network_logs' calls to the clearNetworkLogs method.
    case 'safari_clear_network_logs':
      return await this.clearNetworkLogs(args);
  • MCP server handler method that extracts sessionId from args, calls driverManager.clearNetworkLogs(sessionId), and returns success message.
    private async clearNetworkLogs(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> {
      const { sessionId } = args;
      
      await this.driverManager.clearNetworkLogs(sessionId);
      
      return [
        {
          type: 'text',
          text: `Network logs cleared for session '${sessionId}'`
        }
      ];
    }
  • Core implementation in SafariDriverManager that executes JavaScript in the browser session to reset the __safariMCPNetworkLogs array, effectively clearing captured network logs.
    async clearNetworkLogs(sessionId: string): Promise<void> {
      const session = this.getSession(sessionId);
      if (!session) {
        throw new Error(`Session ${sessionId} not found`);
      }
    
      try {
        await session.driver.executeScript(`
          if (window.__safariMCPNetworkLogs) {
            window.__safariMCPNetworkLogs = [];
          }
        `);
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to clear network logs: ${errorMessage}`);
      }
    }
  • Input schema definition for the tool, specifying an object with required 'sessionId' string property.
    inputSchema: {
      type: 'object',
      properties: {
        sessionId: { type: 'string', description: 'Session identifier' }
      },
      required: ['sessionId']
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool clears logs, implying a destructive mutation, but doesn't specify if this is irreversible, requires specific permissions, or has side effects (e.g., affecting session state). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes 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?

Given the tool's destructive nature (clearing logs) and lack of annotations or output schema, the description is incomplete. It doesn't cover behavioral aspects like irreversibility, error conditions, or what happens after clearing (e.g., does it return confirmation?). For a mutation tool with no structured safety hints, more context is needed to guide safe usage.

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?

The input schema has 100% description coverage, with the single parameter 'sessionId' documented as 'Session identifier'. The description doesn't add any meaning beyond this, such as explaining what a session is or where to obtain the ID. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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

Purpose4/5

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

The description clearly states the action ('Clear') and target resource ('captured network logs for a session'), making the purpose immediately understandable. It distinguishes from sibling tools like 'safari_clear_console_logs' by specifying network logs rather than console logs. However, it doesn't explicitly mention that this is a destructive operation, which would make it fully specific.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active session), when not to use it (e.g., if logs are needed for analysis), or how it relates to siblings like 'safari_get_network_logs'. This leaves the agent to infer usage from context alone.

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/lxman/safari-mcp-server'

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