Skip to main content
Glama
cloudthinker-ai

Postgres MCP Pro Plus

analyze_vacuum_requirements

Analyze PostgreSQL database vacuum requirements to detect bloat and generate maintenance recommendations for optimal performance.

Instructions

Comprehensive vacuum analysis with maintenance recommendations and bloat detection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler implementing the vacuum analysis logic: gathers summary statistics, analyzes table bloat, autovacuum configuration, vacuum performance, generates maintenance and configuration recommendations, identifies critical issues, and formats the results as text.
    async def analyze_vacuum_requirements(self) -> str:
        """Perform comprehensive vacuum analysis and return structured results."""
        try:
            logger.info("Starting comprehensive vacuum analysis...")
    
            analysis_results = {
                "summary": {},
                "bloat_analysis": {},
                "autovacuum_analysis": {},
                "vacuum_performance": {},
                "maintenance_recommendations": [],
                "critical_issues": [],
                "configuration_recommendations": [],
            }
    
            # Get basic statistics
            await self._get_vacuum_summary(analysis_results)
    
            # Analyze table bloat
            await self._analyze_table_bloat(analysis_results)
    
            # Analyze autovacuum configuration
            await self._analyze_autovacuum_config(analysis_results)
    
            # Analyze vacuum performance
            await self._analyze_vacuum_performance(analysis_results)
    
            # Generate maintenance recommendations
            await self._generate_maintenance_recommendations(analysis_results)
    
            # Check for critical issues
            await self._identify_critical_issues(analysis_results)
    
            # Generate configuration recommendations
            await self._generate_configuration_recommendations(analysis_results)
    
            logger.info("Vacuum analysis completed successfully")
            return self._format_as_text(analysis_results)
    
        except Exception as e:
            logger.error(f"Error in vacuum analysis: {e}")
            error_result = {
                "error": f"Vacuum analysis failed: {e!s}",
                "summary": {},
                "bloat_analysis": {},
                "autovacuum_analysis": {},
                "vacuum_performance": {},
                "maintenance_recommendations": [],
                "critical_issues": [],
                "configuration_recommendations": [],
            }
            return self._format_as_text(error_result)
  • MCP tool registration and top-level handler for 'analyze_vacuum_requirements'. Instantiates VacuumAnalysisTool and delegates to its analyze_vacuum_requirements method, handling errors and formatting the response.
    @mcp.tool(description="Comprehensive vacuum analysis with maintenance recommendations and bloat detection")
    async def analyze_vacuum_requirements() -> ResponseType:
        """Analyze database vacuum requirements with comprehensive recommendations for maintenance."""
        try:
            sql_driver = await get_sql_driver()
            vacuum_tool = VacuumAnalysisTool(sql_driver)
    
            # Perform comprehensive vacuum analysis
            result = await vacuum_tool.analyze_vacuum_requirements()
    
            return format_text_response(result)
    
        except Exception as e:
            logger.error(f"Error analyzing vacuum requirements: {e}")
            return format_error_response(str(e))
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'analysis' implies a read-only operation, the description doesn't explicitly state whether this is a safe read operation or if it has any side effects. It mentions 'maintenance recommendations' but doesn't clarify if these are just suggestions or if any actions are taken. For a tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 a single, efficient sentence that communicates the core functionality. It's appropriately sized for a tool with no parameters. While it could potentially be more specific about what 'comprehensive' entails, the description doesn't waste words and gets straight to the point.

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 of database analysis tools and the lack of both annotations and output schema, the description is insufficient. It doesn't explain what format the analysis results will take, what 'bloat detection' specifically means, or what kind of maintenance recommendations are provided. For a tool that presumably returns detailed analysis results, the description should provide more context about the output format and scope.

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 tool has 0 parameters with 100% schema description coverage, so there's no parameter documentation burden. The description appropriately doesn't discuss parameters since none exist. The baseline for 0 parameters is 4, as there's no need to compensate for missing parameter documentation.

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 tool performs 'comprehensive vacuum analysis' with 'maintenance recommendations and bloat detection', which gives a general sense of purpose. However, it doesn't clearly distinguish this from sibling tools like 'analyze_db_health' or 'analyze_query_indexes' - all seem to be analysis tools for database optimization. The description lacks a specific verb+resource combination that would differentiate it from similar analysis tools.

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. With multiple analysis tools available (analyze_db_health, analyze_query_indexes, analyze_schema_relationships, analyze_workload_indexes), there's no indication of when vacuum analysis is appropriate versus other types of database analysis. No prerequisites, exclusions, or alternative recommendations are mentioned.

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/cloudthinker-ai/postgres-mcp-pro-plus'

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