Skip to main content
Glama
rubinsh

MCP Windows Screenshots

by rubinsh

list_screenshots

Retrieve and list recent Windows screenshots from specified directories using a customizable filter pattern and limit. Simplify screenshot sharing by avoiding manual file path navigation.

Instructions

List recent screenshots from Windows directories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoSpecific directory to search (optional, searches all configured dirs by default)
limitNoMaximum number of screenshots to return (default: 20)
patternNoGlob pattern to filter files (default: *.{png,jpg,jpeg,bmp,gif})*.{png,jpg,jpeg,bmp,gif}

Implementation Reference

  • Main execution logic for list_screenshots tool: gathers directories, globs for image files, stats them, sorts by recency, limits, and returns JSON list.
    case 'list_screenshots': {
      const limit = (args?.limit as number) || 20;
      const pattern = (args?.pattern as string) || '*.{png,jpg,jpeg,bmp,gif}';
      const specificDir = args?.directory as string | undefined;
      
      const directories = specificDir 
        ? [specificDir] 
        : [...getScreenshotDirectories(), ...getCustomDirectories()];
      
      const allFiles: { path: string; mtime: Date; size: number }[] = [];
      
      for (const dir of directories) {
        try {
          const files = await glob(path.join(dir, pattern as string), {
            windowsPathsNoEscape: true,
            nodir: true,
          });
          
          for (const file of files) {
            try {
              const stats = await stat(file);
              allFiles.push({
                path: file,
                mtime: stats.mtime,
                size: stats.size,
              });
            } catch (e) {
              // Skip files we can't stat
            }
          }
        } catch (e) {
          // Skip directories that don't exist or can't be accessed
        }
      }
      
      // Sort by modification time (newest first) and limit
      allFiles.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
      const limitedFiles = allFiles.slice(0, limit as number);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              count: limitedFiles.length,
              total_found: allFiles.length,
              screenshots: limitedFiles.map(f => ({
                path: f.path,
                modified: f.mtime.toISOString(),
                size_kb: Math.round(f.size / 1024),
              })),
            }, null, 2),
          },
        ],
      };
    }
  • Input schema defining parameters: limit (number, default 20), pattern (string glob, default image extensions), directory (optional specific dir).
    {
      name: 'list_screenshots',
      description: 'List recent screenshots from Windows directories',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of screenshots to return (default: 20)',
            default: 20,
          },
          pattern: {
            type: 'string',
            description: 'Glob pattern to filter files (default: *.{png,jpg,jpeg,bmp,gif})',
            default: '*.{png,jpg,jpeg,bmp,gif}',
          },
          directory: {
            type: 'string',
            description: 'Specific directory to search (optional, searches all configured dirs by default)',
          },
        },
      },
    },
  • src/index.ts:230-232 (registration)
    Registration of ListToolsRequestHandler which returns the tools array including list_screenshots.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools,
    }));
  • src/index.ts:234-234 (registration)
    Registration of CallToolRequestHandler containing the switch dispatching to list_screenshots handler.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
  • Key helper to get list of screenshot directories, supports WSL/Windows, registry query, defaults, dedupes.
    const getScreenshotDirectories = (): string[] => {
      const username = os.userInfo().username;
      const windowsUsername = process.env.WINDOWS_USERNAME || username;
      const env = detectEnvironment();
      
      // Try to get the actual Screenshots folder from registry first
      const registryPath = getWindowsScreenshotPath();
      const directories: string[] = [];
      
      if (registryPath) {
        directories.push(registryPath);
      }
      
      // Add default paths based on environment
      if (env.type === 'wsl') {
        // WSL paths
        directories.push(
          `/mnt/c/Users/${windowsUsername}/Pictures/Screenshots`,
          `/mnt/c/Users/${windowsUsername}/Pictures`,
          `/mnt/c/Users/${windowsUsername}/OneDrive/Pictures/Screenshots`,
          `/mnt/c/Users/${windowsUsername}/OneDrive/Pictures 2/Screenshots 1`,
          `/mnt/c/Users/${windowsUsername}/Documents/Screenshots`,
          `/mnt/c/Users/${windowsUsername}/Desktop`,
          `/mnt/c/Users/${windowsUsername}/AppData/Local/Temp`,
          `/mnt/c/Windows/Temp`
        );
      } else if (env.type === 'windows') {
        // Native Windows paths
        directories.push(
          `C:\\Users\\${windowsUsername}\\Pictures\\Screenshots`,
          `C:\\Users\\${windowsUsername}\\Pictures`,
          `C:\\Users\\${windowsUsername}\\OneDrive\\Pictures\\Screenshots`,
          `C:\\Users\\${windowsUsername}\\OneDrive\\Pictures 2\\Screenshots 1`,
          `C:\\Users\\${windowsUsername}\\Documents\\Screenshots`,
          `C:\\Users\\${windowsUsername}\\Desktop`,
          `C:\\Users\\${windowsUsername}\\AppData\\Local\\Temp`,
          `C:\\Windows\\Temp`
        );
      }
      
      // Remove duplicates
      return [...new Set(directories)];
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool lists 'recent screenshots' but doesn't explain how 'recent' is determined (e.g., by timestamp, file system order), whether it's a read-only operation, what the output format looks like, or if there are any rate limits or permissions required. This leaves significant gaps in understanding the tool's behavior.

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, efficient sentence that front-loads the core purpose without unnecessary words. It directly communicates the tool's function, making it easy to parse and understand quickly. Every word earns its place, and there's no redundancy or fluff.

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 lack of annotations and output schema, the description is incomplete. It doesn't address key behavioral aspects like how 'recent' is defined, the output structure, or error handling. For a tool with three parameters and no structured output documentation, the description should provide more context to compensate, but it falls short.

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%, with all parameters well-documented in the schema itself (directory, limit, pattern). The description adds no additional meaning beyond what the schema provides, such as explaining how parameters interact or typical use cases. However, the baseline score of 3 is appropriate since the schema adequately covers parameter semantics.

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 ('List') and resource ('recent screenshots from Windows directories'), making the purpose immediately understandable. It doesn't explicitly distinguish from sibling tools like 'get_screenshot' (which likely retrieves a single screenshot) or 'list_directories' (which lists directories rather than files), but the verb+resource combination is specific enough for basic understanding.

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 like 'get_screenshot' or 'list_directories'. It mentions 'recent screenshots' but doesn't define what 'recent' means or specify any prerequisites or exclusions. Without this context, an agent might struggle to choose between this and its siblings.

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

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