Skip to main content
Glama

analyze_workload_indexes

Analyze frequently executed PostgreSQL queries to recommend optimal indexes for improved database performance and query 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
methodNoMethod to use for analysisdta

Implementation Reference

  • The implementation of the `analyze_workload_indexes` tool, which delegates to either `DatabaseTuningAdvisor` or `LLMOptimizerTool` via `TextPresentation`.
    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)
  • Registration of the `analyze_workload_indexes` tool using `@mcp.tool`.
    @mcp.tool(description="Analyze frequently executed queries in the database and recommend optimal indexes")
Behavior2/5

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

With no annotations provided, the description fails to disclose whether this operation is read-only or modifies system state, whether recommendations are persisted, execution duration expectations, or required permissions. 'Analyze' implies read-only but lacks explicit confirmation.

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?

Single sentence efficiently delivers core purpose without redundancy. Front-loaded with action verb. However, extreme brevity contributes to gaps in behavioral transparency and usage guidelines.

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?

Covers basic intent but leaves significant gaps given the presence of semantically similar siblings (analyze_query_indexes, analyze_db_health) and lack of annotations. Should clarify scope boundaries and safety profile for a database analysis tool.

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?

Input schema has 100% description coverage ('Max index size in MB', 'Method to use for analysis'), so the schema documents parameters adequately. The description adds no parameter-specific guidance, earning the baseline score for well-documented schemas.

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?

States specific action (Analyze) and target resource (frequently executed queries) with clear outcome (recommend optimal indexes). The 'frequently executed' qualifier helps distinguish from sibling analyze_query_indexes, though it doesn't explicitly clarify the workload-level scope versus single-query analysis.

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?

Provides no guidance on when to use this tool versus close sibling analyze_query_indexes or when to prefer 'dta' versus 'llm' method. No prerequisites, exclusions, or selection criteria 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/moecodeshere/mcptrial'

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