Skip to main content
Glama

get_performance_stats

Retrieve SQL Server performance statistics and health summaries to monitor database efficiency and identify optimization opportunities.

Instructions

Get overall performance statistics and health summary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeframeNoTime period for stats: "recent" (last 5 min), "session" (since startup), "all" (default)

Implementation Reference

  • The main handler function for the 'get_performance_stats' tool. It retrieves performance statistics from the PerformanceMonitor instance and formats them as a JSON text response.
    getPerformanceStats() { const stats = this.performanceMonitor.getStats(); return [ { type: 'text', text: JSON.stringify( { success: true, data: stats }, null, 2 ) } ]; }
  • The input schema definition for the 'get_performance_stats' tool, defining an optional 'timeframe' parameter.
    { name: 'get_performance_stats', description: 'Get overall performance statistics and health summary', inputSchema: { type: 'object', properties: { timeframe: { type: 'string', description: 'Time period for stats: "recent" (last 5 min), "session" (since startup), "all" (default)', enum: ['recent', 'session', 'all'] } } } },
  • index.js:313-316 (registration)
    The switch case registration in the CallToolRequest handler that routes 'get_performance_stats' calls to the getPerformanceStats() method.
    case 'get_performance_stats': return { content: this.getPerformanceStats() };
  • The core PerformanceMonitor.getStats() method that computes and returns the performance statistics (overall, recent, pool, monitoring) used by the tool handler.
    getStats() { if (!this.config.enabled) { return { enabled: false }; } const now = Date.now(); const uptime = now - this.startTime; // Calculate recent performance (last 5 minutes) const recentThreshold = now - 5 * 60 * 1000; const recentQueries = this.metrics.queries.filter( q => q.startTime > recentThreshold && q.status === 'completed' ); const recentStats = this.calculateQueryStats(recentQueries); return { enabled: true, uptime, overall: this.metrics.aggregates, recent: recentStats, pool: this.metrics.poolStats, monitoring: { totalQueriesTracked: this.metrics.queries.length, totalConnectionEvents: this.metrics.connections.length, samplingRate: this.config.samplingRate, slowQueryThreshold: this.config.slowQueryThreshold } }; }

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