Skip to main content
Glama

get_performance_stats

Retrieve SQL Server performance statistics and health summary for monitoring database operations, with timeframe options for recent, session, or all-time data.

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 stats from the PerformanceMonitor instance and formats them as JSON text content.
    getPerformanceStats() { const stats = this.performanceMonitor.getStats(); return [ { type: 'text', text: JSON.stringify( { success: true, data: stats }, null, 2 ) } ]; }
  • Input schema definition for the get_performance_stats tool, including 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)
    Registration and dispatch of the get_performance_stats handler in the main tool switch statement.
    case 'get_performance_stats': return { content: this.getPerformanceStats() };
  • Core helper method PerformanceMonitor.getStats() that computes and returns the performance statistics 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 } }; }
  • index.js:241-243 (registration)
    Registration of tool list handler that includes get_performance_stats via getAllTools() from tool-registry.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getAllTools() }));

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