Skip to main content
Glama
rubinsh

MCP Windows Screenshots

by rubinsh

get_screenshot

Retrieve specified screenshot file paths or base64-encoded content directly from Windows via WSL2, simplifying access and sharing without manual file navigation.

Instructions

Get a specific screenshot file path or content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFull path to the screenshot file
return_contentNoReturn base64 encoded content instead of just the path (default: false)

Implementation Reference

  • Handler function for the 'get_screenshot' tool. Validates input path, stats the file, and returns file metadata. If return_content is true, reads the file and returns base64-encoded content as data URL; otherwise, returns path and metadata with instructions.
    case 'get_screenshot': {
      const filePath = args?.path as string | undefined;
      const returnContent = (args?.return_content as boolean) || false;
      
      if (!filePath) {
        throw new Error('File path is required');
      }
      
      try {
        const stats = await stat(filePath);
        
        if (returnContent) {
          const content = await readFile(filePath);
          const base64 = content.toString('base64');
          const mimeType = path.extname(filePath as string).toLowerCase() === '.png' 
            ? 'image/png' 
            : 'image/jpeg';
          
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  path: filePath,
                  modified: stats.mtime.toISOString(),
                  size_kb: Math.round(stats.size / 1024),
                  content: `data:${mimeType};base64,${base64}`,
                }, null, 2),
              },
            ],
          };
        } else {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  path: filePath,
                  modified: stats.mtime.toISOString(),
                  size_kb: Math.round(stats.size / 1024),
                  message: 'Use this path with Claude Code\'s Read tool to view the image',
                }, null, 2),
              },
            ],
          };
        }
      } catch (error) {
        throw new Error(`Failed to access screenshot: ${error}`);
      }
    }
  • src/index.ts:200-219 (registration)
    Tool registration in the tools list, defining name, description, and input schema for 'get_screenshot'. Used by the ListTools handler.
    {
      name: 'get_screenshot',
      description: 'Get a specific screenshot file path or content',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Full path to the screenshot file',
          },
          return_content: {
            type: 'boolean',
            description: 'Return base64 encoded content instead of just the path (default: false)',
            default: false,
          },
        },
        required: ['path'],
      },
    },
    {
  • Input schema definition for the 'get_screenshot' tool, specifying required 'path' and optional 'return_content' parameters.
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Full path to the screenshot file',
          },
          return_content: {
            type: 'boolean',
            description: 'Return base64 encoded content instead of just the path (default: false)',
            default: false,
          },
        },
        required: ['path'],
      },
    },
    {
Install Server

Other Tools

Related 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/rubinsh/mcp-windows-screenshots'

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