Skip to main content
Glama
daekeun-ml

PowerPoint Translator

by daekeun-ml

get_slide_info

Extract detailed slide information from PowerPoint presentations, including slide count and previews, for efficient content analysis and management.

Instructions

Get information about slides in a PowerPoint presentation.

Args: input_file: Path to the PowerPoint file (.pptx)

Returns: Information about the presentation including slide count and preview of each slide

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
input_fileYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_slide_info' MCP tool. It validates the input PPTX file path, retrieves the slide count and previews (up to 10 slides) using PowerPointTranslator, formats a detailed information report, and includes usage examples. Registered via @mcp.tool() decorator.
    @mcp.tool()
    def get_slide_info(input_file: str) -> str:
        """
        Get information about slides in a PowerPoint presentation.
        
        Args:
            input_file: Path to the PowerPoint file (.pptx)
        
        Returns:
            Information about the presentation including slide count and preview of each slide
        """
        try:
            # Validate input file using helper function
            input_path, error_msg = validate_input_path(input_file)
            if error_msg:
                return error_msg
            
            # Create translator to access slide info methods
            translator = PowerPointTranslator()
            slide_count = translator.get_slide_count(str(input_path))
            
            info_text = f"""📊 PowerPoint Presentation Information
    
    📁 File: {input_path}
    📄 Total slides: {slide_count}
    
    📋 Slide previews:
    """
            
            # Get preview for each slide (limit to first 10 slides for readability)
            max_preview_slides = min(slide_count, 10)
            for i in range(1, max_preview_slides + 1):
                try:
                    preview = translator.get_slide_preview(str(input_path), i, max_chars=150)
                    info_text += f"\n🔸 Slide {i}: {preview}"
                except Exception as e:
                    info_text += f"\n🔸 Slide {i}: [Error getting preview: {str(e)}]"
            
            if slide_count > 10:
                info_text += f"\n\n... and {slide_count - 10} more slides"
            
            info_text += f"""
    
    💡 Usage examples:
    • Translate all slides: translate_powerpoint("{input_file}")
    • Translate specific slides: translate_specific_slides("{input_file}", "1,3,5")
    • Translate slide range: translate_specific_slides("{input_file}", "2-4")"""
            
            return info_text
            
        except Exception as e:
            logger.error(f"Failed to get slide info: {str(e)}")
            return f"❌ Failed to get slide info: {str(e)}"
  • Shared helper function used by get_slide_info (and other tools) to validate and resolve the input PowerPoint file path, checking existence and .pptx extension, providing detailed error messages.
    def validate_input_path(input_file: str) -> tuple[Path, str]:
        """
        Validate input file path, handling both absolute and relative paths.
        
        Args:
            input_file: Input file path (absolute or relative)
        
        Returns:
            Tuple of (validated_path, error_message). If error_message is not empty, path validation failed.
        """
        input_path = Path(input_file)
        
        # If it's a relative path, try to resolve it from current working directory
        if not input_path.is_absolute():
            # Try current working directory first
            cwd_path = Path.cwd() / input_file
            if cwd_path.exists():
                input_path = cwd_path
            else:
                # Try the script's directory as fallback
                script_dir = Path(__file__).parent
                script_path = script_dir / input_file
                if script_path.exists():
                    input_path = script_path
        
        if not input_path.exists():
            # Provide more helpful error message with current working directory info
            cwd = Path.cwd()
            script_dir = Path(__file__).parent
            error_msg = f"""❌ Error: File not found: {input_file}
    📁 Current working directory: {cwd}
    📁 Script directory: {script_dir}
    💡 Tried paths:
       • {input_file} (as provided)
       • {cwd / input_file} (from current directory)
       • {script_dir / input_file} (from script directory)
    💡 Try using absolute path or ensure file is in one of these directories"""
            return input_path, error_msg
        
        if not input_path.suffix.lower() == '.pptx':
            return input_path, f"❌ Error: File must be a PowerPoint (.pptx) file: {input_file}"
        
        return input_path, ""
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 reads information ('Get information'), implying it is likely read-only, but does not confirm this or address other traits like error handling, performance, or security requirements. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with a clear purpose statement followed by structured 'Args' and 'Returns' sections. It avoids unnecessary details, though the 'Returns' section could be more concise by leveraging the output schema.

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?

Given the tool's low complexity (1 parameter, no nested objects) and the presence of an output schema, the description is reasonably complete. It covers the purpose, parameter semantics, and return overview, though it lacks usage guidelines and behavioral details, which are important given the absence of annotations.

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

Parameters4/5

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

The description adds meaningful context for the single parameter: 'input_file: Path to the PowerPoint file (.pptx)'. Since schema description coverage is 0% (the schema only provides title and type), this compensates well by specifying the file format and purpose. However, it does not detail constraints like file size or accessibility, preventing a perfect score.

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 tool's purpose: 'Get information about slides in a PowerPoint presentation.' It specifies the verb ('Get information') and resource ('slides in a PowerPoint presentation'), but does not explicitly differentiate it from sibling tools like 'get_slide_preview' or 'post_process_powerpoint', which prevents a score of 5.

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. It does not mention sibling tools such as 'get_slide_preview' (which might provide visual previews) or 'post_process_powerpoint' (which might modify presentations), leaving the agent without context for tool selection.

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/daekeun-ml/ppt-translator'

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