Skip to main content
Glama
lxman

Safari MCP Server

by lxman

safari_clear_console_logs

Remove captured console logs from a Safari browser session to maintain clean debugging environments and manage log data.

Instructions

Clear captured console logs for a session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • Defines the tool schema for safari_clear_console_logs, specifying the input as an object requiring 'sessionId'.
    {
      name: 'safari_clear_console_logs',
      description: 'Clear captured console logs for a session',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'Session identifier' }
        },
        required: ['sessionId']
      }
    },
  • MCP tool handler that delegates to SafariDriverManager.clearConsoleLogs(sessionId) and returns a success message.
    private async clearConsoleLogs(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> {
      const { sessionId } = args;
      
      await this.driverManager.clearConsoleLogs(sessionId);
      
      return [
        {
          type: 'text',
          text: `Console logs cleared for session '${sessionId}'`
        }
      ];
  • Executes JavaScript in the browser context to clear the __safariMCPConsoleLogs array, which captures console.log calls.
    async clearConsoleLogs(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.__safariMCPConsoleLogs) {
            window.__safariMCPConsoleLogs = [];
          }
        `);
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to clear console logs: ${errorMessage}`);
      }
    }
  • Switch case in handleToolCall that routes calls to the clearConsoleLogs handler.
    case 'safari_clear_console_logs':
      return await this.clearConsoleLogs(args);
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 implies a destructive action ('Clear') but does not specify if this is irreversible, requires specific permissions, affects other session data, or has side effects like resetting logs. This leaves significant gaps in understanding the tool's behavior, warranting a low score.

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, direct sentence that efficiently conveys the core action without unnecessary words. It is front-loaded and wastes no space, earning a perfect score for conciseness.

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 (implied by 'Clear'), no annotations, and no output schema, the description is insufficient. It fails to address critical aspects like what 'clearing' entails, potential impacts, or return values, making it incomplete for safe and effective use by an AI agent.

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 'sessionId' documented as 'Session identifier'. The description adds no additional meaning beyond this, such as format examples or constraints. According to the rules, with high schema coverage, the baseline is 3, which is appropriate here.

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 the resource ('captured console logs for a session'), making the purpose understandable. It distinguishes from siblings like 'safari_get_console_logs' by specifying a destructive operation, though it doesn't explicitly name alternatives. This earns a 4 for clarity without full sibling differentiation.

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, such as 'safari_clear_network_logs' or 'safari_close_session', nor does it mention prerequisites like needing an active session. Without any context on usage scenarios or exclusions, it scores a 2 for lacking guidance.

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