Skip to content

get_last_screenshot

Retrieve the most recent screenshot as base64 encoded PNG data.

Overview

The get_last_screenshot tool returns the most recently taken screenshot from the configured screenshot directory. This is useful for retrieving previously captured screenshots without taking a new one.

Purpose

  • Review Recent Captures: Access the last screenshot taken
  • Workflow Continuity: Continue working with a previous screenshot
  • Error Recovery: Retrieve screenshot if previous operation failed
  • Batch Processing: Process screenshots after capture

Input Schema

json
{
  "type": "object",
  "properties": {}
}

No parameters required.

Output

Returns the most recent screenshot or a message if none found:

Success Response

json
{
  "content": [
    {
      "type": "text",
      "text": "Last screenshot: /path/to/screenshot.png"
    },
    {
      "type": "image",
      "data": "base64encodedpngdata...",
      "mimeType": "image/png"
    }
  ]
}

No Screenshots Found

json
{
  "content": [
    {
      "type": "text",
      "text": "No screenshots found in the configured directory."
    }
  ]
}

Examples

Basic Usage

typescript
// Get the last screenshot
const result = await get_last_screenshot({});

Workflow Example

typescript
// Take a screenshot
await take_screenshot({});

// Do some processing...

// Later, retrieve the screenshot
const lastScreenshot = await get_last_screenshot({});

Configuration

Uses the same directory as take_screenshot:

bash
export ORCHESTRE_SCREENSHOT_PATH="/path/to/screenshots"

Default: ~/Desktop/orchestre-screenshots

Use Cases

1. Documentation Workflow

typescript
// Capture multiple UI states
await take_screenshot({}); // State 1
// Make changes
await take_screenshot({}); // State 2

// Later, retrieve for documentation
const screenshot = await get_last_screenshot({});

2. Error Analysis

typescript
// If an error occurred and screenshot was taken
try {
  // Some operation
} catch (error) {
  await take_screenshot({});
  
  // Later in error report
  const errorScreenshot = await get_last_screenshot({});
}

3. Verification

typescript
// Verify screenshot was taken successfully
await take_screenshot({});
const verification = await get_last_screenshot({});
// Check if screenshot exists and is valid

File Management

The tool finds the most recent PNG file by:

  1. Scanning the configured directory
  2. Filtering for .png files
  3. Sorting by modification time
  4. Returning the newest file

Best Practices

  1. Check Directory: Ensure screenshot directory exists
  2. Handle No Screenshots: Always handle the case of no screenshots
  3. Clean Old Screenshots: Regularly clean up old screenshots
  4. Verify Timing: Most recent may not be the one you expect

Limitations

  • Only returns PNG files
  • Returns only the most recent screenshot
  • No filtering by date range or other criteria
  • Cannot retrieve specific screenshots by name

Built with ❤️ for the AI Coding community, by Praney Behl