Skip to main content
Glama
lxman

Safari MCP Server

by lxman

safari_take_screenshot

Capture screenshots of web pages in Safari for documentation, debugging, or visual reference during browser automation tasks.

Instructions

Take a screenshot of the current page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • Handler method in SafariMCPServer that processes the tool call, extracts sessionId, calls driverManager.takeScreenshot, and returns text confirmation with base64 image data.
    private async takeScreenshot(args: Record<string, any>): Promise<Array<{ type: string; text?: string; data?: string; mimeType?: string }>> {
      const { sessionId } = args;
      
      const screenshot = await this.driverManager.takeScreenshot(sessionId);
      
      return [
        {
          type: 'text',
          text: `Screenshot captured successfully (${screenshot.length} bytes base64 data)`
        },
        {
          type: 'image',
          data: screenshot,
          mimeType: 'image/png'
        }
      ];
    }
  • Core handler in SafariDriverManager that retrieves the session and calls selenium driver.takeScreenshot() to capture the screenshot.
    async takeScreenshot(sessionId: string): Promise<string> {
      const session = this.getSession(sessionId);
      if (!session) {
        throw new Error(`Session ${sessionId} not found`);
      }
    
      try {
        return await session.driver.takeScreenshot();
      } catch (error: unknown) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Screenshot failed: ${errorMessage}`);
      }
    }
  • Input schema definition for the safari_take_screenshot tool, requiring sessionId.
    {
      name: 'safari_take_screenshot',
      description: 'Take a screenshot of the current page',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: { type: 'string', description: 'Session identifier' }
        },
        required: ['sessionId']
      }
    },
  • Switch case in handleToolCall method that routes the tool call to the takeScreenshot handler.
    case 'safari_take_screenshot':
      return await this.takeScreenshot(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 states the action but doesn't explain what happens after the screenshot is taken (e.g., where it's saved, format, size, or if it's returned as data). This leaves critical behavioral traits like output handling and potential side effects undocumented.

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, clear sentence that directly states the tool's purpose without any unnecessary words. It's front-loaded and efficiently communicates the core function, making it easy to understand at a glance.

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 complexity of a screenshot tool (which involves visual capture and output handling), the description is incomplete. With no annotations and no output schema, it fails to explain what the tool returns (e.g., image data, file path, or error details). This gap makes it inadequate for an agent to fully understand the tool's behavior.

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 sessionId parameter clearly documented. The description doesn't add any additional meaning beyond what the schema provides, such as explaining why a sessionId is needed or how it relates to the 'current page'. This meets the baseline for high schema coverage.

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 ('take a screenshot') and the target ('current page'), which is specific and unambiguous. However, it doesn't distinguish this tool from potential siblings like 'safari_get_page_info' or 'safari_inspect_element' that might also capture visual information, so it falls short of a perfect score.

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 whether it's for debugging, documentation, or visual testing. It also doesn't mention prerequisites like needing an active session, which is implied by the required sessionId parameter but not explicitly stated.

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