Skip to main content
Glama
egarcia74

Warp SQL Server MCP

by egarcia74

get_query_performance

Analyze SQL query performance to identify slow queries and optimize database operations. Filter by specific tools and set limits for targeted performance breakdown.

Instructions

Get detailed query performance breakdown by tool

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of queries to analyze (optional, defaults to 50)
tool_filterNoFilter by specific MCP tool name (optional)
slow_onlyNoOnly return slow queries (optional, defaults to false)

Implementation Reference

  • The main handler function for the 'get_query_performance' tool. It retrieves query performance statistics from the PerformanceMonitor instance and returns them formatted as a JSON text response.
    getQueryPerformance(limit = 50) {
      const queryStats = this.performanceMonitor.getQueryStats(limit);
      return [
        {
          type: 'text',
          text: JSON.stringify(
            {
              success: true,
              data: queryStats
            },
            null,
            2
          )
        }
      ];
    }
  • The tool schema definition including name, description, and input schema for validation.
    {
      name: 'get_query_performance',
      description: 'Get detailed query performance breakdown by tool',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: 'Maximum number of queries to analyze (optional, defaults to 50)'
          },
          tool_filter: { type: 'string', description: 'Filter by specific MCP tool name (optional)' },
          slow_only: {
            type: 'boolean',
            description: 'Only return slow queries (optional, defaults to false)'
          }
        }
      }
    },
  • index.js:318-321 (registration)
    The switch case registration/dispatch that maps the tool name to its handler function during tool call handling.
    case 'get_query_performance':
      return {
        content: this.getQueryPerformance(args.limit)
      };
  • The core helper function getQueryStats in PerformanceMonitor class that processes query metrics, groups by tool, calculates statistics like average time, error rates, and returns detailed performance breakdown.
    getQueryStats(limit = 50) {
      if (!this.config.enabled) {
        return { enabled: false };
      }
    
      const completedQueries = this.metrics.queries
        .filter(q => q.status === 'completed' || q.status === 'error')
        .sort((a, b) => b.startTime - a.startTime)
        .slice(0, limit);
    
      // Group by tool
      const byTool = {};
      completedQueries.forEach(query => {
        if (!byTool[query.tool]) {
          byTool[query.tool] = {
            count: 0,
            totalTime: 0,
            errors: 0,
            slowQueries: 0
          };
        }
    
        byTool[query.tool].count++;
        byTool[query.tool].totalTime += query.duration;
    
        if (query.status === 'error') {
          byTool[query.tool].errors++;
        }
    
        if (query.duration > this.config.slowQueryThreshold) {
          byTool[query.tool].slowQueries++;
        }
      });
    
      // Calculate averages
      Object.keys(byTool).forEach(tool => {
        const stats = byTool[tool];
        stats.avgTime = stats.totalTime / stats.count;
        stats.errorRate = (stats.errors / stats.count) * 100;
        stats.slowQueryRate = (stats.slowQueries / stats.count) * 100;
      });
    
      return {
        enabled: true,
        queries: completedQueries.map(q => ({
          tool: q.tool,
          duration: q.duration,
          status: q.status,
          rowCount: q.rowCount,
          streaming: q.streaming,
          timestamp: q.startTime
        })),
        byTool,
        slowQueries: completedQueries.filter(q => q.duration > this.config.slowQueryThreshold)
      };
    }
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 what the tool does but lacks critical details such as whether this is a read-only operation, potential side effects, rate limits, authentication requirements, or the format of the returned breakdown. For a tool with no annotations, this is a significant gap in transparency.

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 directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly, earning the highest score for conciseness.

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 query performance analysis, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'detailed breakdown' entails, the structure of returned data, or how it differs from similar sibling tools. This leaves the agent with insufficient context to use the tool effectively beyond basic invocation.

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?

The input schema has 100% description coverage, fully documenting all three optional parameters (limit, tool_filter, slow_only) with their types and defaults. The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without adding extra value.

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 action ('Get') and resource ('detailed query performance breakdown by tool'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'analyze_query_performance' or 'get_performance_stats', which appear related, so it misses the highest score for sibling differentiation.

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 sibling tools like 'analyze_query_performance' and 'get_performance_stats' that seem related to performance analysis, there's no indication of context, prerequisites, or exclusions, leaving the agent to guess based on tool names alone.

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/egarcia74/warp-sql-server-mcp'

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