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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Full path to the screenshot file | |
| return_content | No | Return base64 encoded content instead of just the path (default: false) |
Implementation Reference
- src/index.ts:295-344 (handler)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'], }, }, {
- src/index.ts:203-219 (schema)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'], }, }, {