Skip to main content
Glama

analyze_workload_indexes

Identify frequently executed database queries and provide recommendations for optimal indexing to improve query performance and database efficiency.

Instructions

Analyze frequently executed queries in the database and recommend optimal indexes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_index_size_mbNoMax index size in MB

Implementation Reference

  • The main handler function for the 'analyze_workload_indexes' tool. It uses either DatabaseTuningAdvisor or LLMOptimizerTool to analyze workload and recommend indexes, wrapped with validation and error handling.
    @mcp.tool(description="Analyze frequently executed queries in the database and recommend optimal indexes")
    @validate_call
    async def analyze_workload_indexes(
        max_index_size_mb: int = Field(description="Max index size in MB", default=10000),
        method: Literal["dta", "llm"] = Field(description="Method to use for analysis", default="dta"),
    ) -> ResponseType:
        """Analyze frequently executed queries in the database and recommend optimal indexes."""
        try:
            sql_driver = await get_sql_driver()
            if method == "dta":
                index_tuning = DatabaseTuningAdvisor(sql_driver)
            else:
                index_tuning = LLMOptimizerTool(sql_driver)
            dta_tool = TextPresentation(sql_driver, index_tuning)
            result = await dta_tool.analyze_workload(max_index_size_mb=max_index_size_mb)
            return format_text_response(result)
        except Exception as e:
            logger.error(f"Error analyzing workload: {e}")
            return format_error_response(str(e))
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 mentions analysis and recommendations but lacks details on permissions, side effects, rate limits, or output format, which are critical for a tool that likely involves read-only analysis but could impact database performance.

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 functionality without unnecessary words, making it easy to understand quickly and earning its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (analysis and recommendations), no annotations, and no output schema, the description is incomplete. It covers the purpose but lacks behavioral context and output details, leaving gaps that could hinder effective use by an AI agent.

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%, so the schema already documents the single parameter (max_index_size_mb). The description does not add any parameter-specific details beyond what the schema provides, such as typical values or impact on recommendations, meeting the baseline for high schema coverage.

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

Purpose5/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 with specific verbs ('analyze' and 'recommend') and resources ('frequently executed queries' and 'optimal indexes'), distinguishing it from siblings like analyze_db_health or get_top_queries by focusing on index recommendations rather than general health or query listing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for database performance optimization but does not explicitly state when to use this tool versus alternatives like analyze_query_indexes or explain_query, nor does it mention prerequisites or exclusions, leaving some ambiguity in context.

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/crystaldba/postgres-mcp'

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