Skip to main content
Glama
yshk-mrt

Presentation Buddy MCP Server

by yshk-mrt

TakeSourceScreenshot

Capture screenshots from OBS sources for presentations or documentation. Save images with customizable formats, dimensions, and compression settings.

Instructions

Takes a screenshot of the specified source.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Handler for the 'TakeSourceScreenshot' tool. Extracts source name and optional image parameters, constructs file path in screenshots directory, calls OBS 'SaveSourceScreenshot' via sendToObs, and returns a resource URI pointing to the saved screenshot file.
    case "TakeSourceScreenshot":
        // Try to get source from params or params.params
        const mcpInputParams = params.params || params;
        const sourceNameForScreenshot = mcpInputParams.source; // Assuming 'source' is the key from MCP
    
        if (!sourceNameForScreenshot) {
            console.error("TakeSourceScreenshot Error: Missing required parameter 'source'. Params received:", JSON.stringify(params, null, 2));
            throw new Error("Missing required parameter: source");
        }
        
        // Ensure sourceNameForScreenshot is a string before calling replace
        if (typeof sourceNameForScreenshot !== 'string') {
            console.error("TakeSourceScreenshot Error: 'source' parameter is not a string. Value:", sourceNameForScreenshot);
            throw new Error("'source' parameter must be a string.");
        }
    
        console.log(`Executing TakeSourceScreenshot for source: ${sourceNameForScreenshot}`);
    
        const format = mcpInputParams.imageFormat || "png";
        const timestamp = Date.now();
        const filename = `screenshot-${sourceNameForScreenshot.replace(/[^a-z0-9]/gi, '_')}-${timestamp}.${format}`;
        const absoluteFilePath = path.join(SCREENSHOTS_DIR_ABS, filename);
        
        // URI that will be returned to the client
        const resourceUri = `file://${absoluteFilePath}`;
    
        console.log(`Attempting to save screenshot to: ${absoluteFilePath}`);
    
        try {
            const obsRequestData: any = {
                sourceName: sourceNameForScreenshot, // OBS uses sourceName for SaveSourceScreenshot
                imageFormat: format,
                imageFilePath: absoluteFilePath, 
            };
            if (mcpInputParams.width !== undefined) obsRequestData.imageWidth = mcpInputParams.width;
            if (mcpInputParams.height !== undefined) obsRequestData.imageHeight = mcpInputParams.height;
            if (mcpInputParams.compressionQuality !== undefined) obsRequestData.imageCompressionQuality = mcpInputParams.compressionQuality;
    
            // Use SaveSourceScreenshot OBS request
            const obsResponse = await sendToObs("SaveSourceScreenshot", obsRequestData, context, "TakeSourceScreenshot");
            
            console.log(`SaveSourceScreenshot OBS response:`, obsResponse); 
            console.log(`Screenshot for source ${sourceNameForScreenshot} saved to ${absoluteFilePath}. Returning URI: ${resourceUri}`);
            
            // Return the URI to the client as a resource
            return {
                content: [{
                    type: "resource",
                    resource: {
                        uri: resourceUri,
                        text: `Screenshot for ${sourceNameForScreenshot} available at ${filename}`,
                        // mimeType: `image/${format}` // Optional: include mimeType if known
                    }
                }],
                filename: filename // Additional top-level info
            };
    
        } catch (e: any) {
            console.error(`Error in TakeSourceScreenshot for source ${sourceNameForScreenshot}:`, e.message);
            throw new Error(`Failed to take screenshot for ${sourceNameForScreenshot}: ${e.message}`);
        }
        break;
Behavior2/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 states the action but lacks critical details: whether this requires specific permissions, if it's destructive (e.g., overwrites files), what happens on failure, or typical response behavior. This leaves significant gaps for an agent to understand the tool's operation.

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, clear sentence with no wasted words. It's appropriately sized for the basic action described and is front-loaded with the core purpose.

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 complexity (6 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what 'source' means in this context, how parameters interact, what the tool returns, or error conditions. For a tool with multiple configuration options, this leaves too much undefined.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides no information about parameters, while the schema has 0% description coverage (based on context signals). With 6 parameters (source, filePath, width, height, compressionQuality, imageFormat) all undocumented in both schema and description, this fails to add any meaningful semantics beyond the tool name.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('takes a screenshot') and target ('specified source'), which provides a basic purpose. However, it doesn't differentiate this from potential sibling tools or specify what type of source is being captured (e.g., OBS source vs. general source), making it somewhat vague.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing an active source), exclusions, or related tools like 'SaveReplayBuffer' that might serve similar purposes in different contexts.

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/yshk-mrt/obs-mcp'

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