Skip to main content
Glama
Radek44

MCP Tauri Automation

by Radek44

capture_screenshot

Capture application window screenshots as PNG images, returning base64 data or saving to file for automated testing and documentation.

Instructions

Capture a screenshot of the application window. Returns base64-encoded PNG image data by default.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoOptional filename (without extension) to save the screenshot. If not provided, a timestamp will be used.
returnBase64NoWhether to return base64 image data (true) or save to file and return path (false). Default: true

Implementation Reference

  • Primary handler function for the 'capture_screenshot' tool. Processes input parameters, invokes the TauriDriver's screenshot method, and returns a standardized ToolResponse with base64 data or file path.
    export async function captureScreenshot(
      driver: TauriDriver,
      params: ScreenshotParams = {}
    ): Promise<ToolResponse<{ path?: string; base64?: string; message: string }>> {
      try {
        const returnBase64 = params.returnBase64 ?? true; // Default to base64 for MCP
        const result = await driver.captureScreenshot(params.filename, returnBase64);
    
        if (returnBase64) {
          return {
            success: true,
            data: {
              base64: result,
              message: 'Screenshot captured successfully',
            },
          };
        } else {
          return {
            success: true,
            data: {
              path: result,
              message: `Screenshot saved to: ${result}`,
            },
          };
        }
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : String(error),
        };
      }
    }
  • MCP server CallToolRequest handler case for 'capture_screenshot'. Calls the tool function and formats the response, including special handling for image content in MCP format.
    case 'capture_screenshot': {
      const result = await captureScreenshot(driver, args as any);
    
      if (result.success && result.data?.base64) {
        // Return both text description and image
        return {
          content: [
            {
              type: 'text',
              text: result.data.message,
            },
            {
              type: 'image',
              data: result.data.base64,
              mimeType: 'image/png',
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • src/index.ts:84-101 (registration)
    Registration of the 'capture_screenshot' tool in the MCP server's ListToolsRequest handler, including name, description, and input schema.
    {
      name: 'capture_screenshot',
      description: 'Capture a screenshot of the application window. Returns base64-encoded PNG image data by default.',
      inputSchema: {
        type: 'object',
        properties: {
          filename: {
            type: 'string',
            description: 'Optional filename (without extension) to save the screenshot. If not provided, a timestamp will be used.',
          },
          returnBase64: {
            type: 'boolean',
            description: 'Whether to return base64 image data (true) or save to file and return path (false). Default: true',
            default: true,
          },
        },
      },
    },
  • Low-level implementation in TauriDriver class that captures the screenshot using WebDriverIO's takeScreenshot(), returns base64 or saves to file.
    async captureScreenshot(filename?: string, returnBase64: boolean = false): Promise<string> {
      this.ensureAppRunning();
    
      const screenshot = await this.appState.browser!.takeScreenshot();
    
      if (returnBase64) {
        return screenshot;
      }
    
      // Save to file
      const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
      const fileName = filename ? `${filename}.png` : `screenshot-${timestamp}.png`;
      const filePath = path.join(this.config.screenshotDir, fileName);
    
      await fs.writeFile(filePath, screenshot, 'base64');
      return filePath;
    }
Behavior4/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 effectively describes the return behavior (base64-encoded PNG image data by default) and implies a capture action. However, it doesn't mention potential side effects like whether this pauses the application, requires specific permissions, or has any rate limits.

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 perfectly concise with two sentences that each earn their place. The first sentence states the core purpose, and the second sentence provides crucial behavioral information about the return format. There's zero wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 2 parameters, 100% schema coverage, and no output schema, the description provides good context about what the tool does and its return behavior. However, as a potentially system-interactive tool with no annotations, it could benefit from mentioning any permissions needed or system requirements.

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 description coverage is 100%, so the schema already fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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?

The description clearly states the specific action ('capture a screenshot') and target resource ('application window'), distinguishing it from sibling tools like click_element or type_text. It's not a tautology of the name and provides concrete information about what the tool does.

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

Usage Guidelines3/5

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

The description implies usage context (when you need a screenshot of the application) but doesn't explicitly state when to use this tool versus alternatives or mention any prerequisites. No guidance is provided about when not to use it or what alternatives might exist for similar functionality.

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/Radek44/mcp-tauri-automation'

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