perplexity_analytics
Analyze performance metrics and usage data to monitor and optimize the integration's effectiveness and track operational insights.
Instructions
Get detailed analytics and performance metrics for the Perplexity MCP server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:742-749 (handler)Handler for the 'perplexity_analytics' tool call. Calls getAnalytics() on the MCP instance and returns the analytics data wrapped in the expected MCP response format.case "perplexity_analytics": const analytics = nascoderMCP.getAnalytics(); return { content: [{ type: "object", data: analytics }] };
- index.js:674-682 (registration)Registration of the 'perplexity_analytics' tool in the TOOLS array, which is returned by the ListToolsRequestSchema handler. Includes name, description, and empty input schema since no parameters are needed.{ name: "perplexity_analytics", description: "Get detailed analytics and performance metrics for the Perplexity MCP server", inputSchema: { type: "object", properties: {}, required: [] } },
- index.js:677-681 (schema)Input schema for the 'perplexity_analytics' tool, which is an empty object since the tool requires no parameters.inputSchema: { type: "object", properties: {}, required: [] }
- index.js:547-573 (helper)Helper method getAnalytics() that compiles and returns detailed performance metrics, including request counts, cache statistics, token usage, model usage, uptime, and memory usage.getAnalytics() { try { const analytics = { ...this.analytics, cacheStats: { keys: this.cache ? this.cache.keys().length : 0, hits: this.analytics.cacheHits, misses: this.analytics.cacheMisses, hitRate: this.analytics.cacheHits + this.analytics.cacheMisses > 0 ? (this.analytics.cacheHits / (this.analytics.cacheHits + this.analytics.cacheMisses) * 100) : 0 }, uptime: process.uptime(), memoryUsage: process.memoryUsage(), version: '2.0.0', apiVersion: '2025' }; return analytics; } catch (error) { this.logger.error('Failed to get analytics:', error.message); return { error: 'Failed to retrieve analytics', totalRequests: this.analytics?.totalRequests || 0, errors: this.analytics?.errors || 0 }; } }