thealeph_current_stats
Retrieve API usage statistics for The Aleph MCP server over a specified period to monitor network intelligence tool consumption.
Instructions
Get current API usage statistics for the last N days
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | Number of days to retrieve statistics for (1-30) |
Implementation Reference
- src/tools.js:283-303 (handler)The main handler function for the 'thealeph_current_stats' tool. It extracts the 'days' parameter, calls the client to fetch stats, formats the response as markdown, and handles errors.async currentStats(params) { try { const { days = 1 } = params; const result = await this.client.getCurrentStats(days); let response = `📊 The Aleph API Statistics (Last ${days} day${days > 1 ? 's' : ''})\n\n`; if (typeof result === 'object') { for (const [key, value] of Object.entries(result)) { response += `**${key}:** ${JSON.stringify(value, null, 2)}\n`; } } else { response += `${JSON.stringify(result, null, 2)}`; } return response; } catch (error) { return `❌ Failed to retrieve current statistics: ${error.message}`; } }
- src/tools.js:30-42 (schema)Input schema validation for the tool, specifying the optional 'days' parameter with constraints.inputSchema: { type: 'object', properties: { days: { type: 'integer', description: 'Number of days to retrieve statistics for (1-30)', minimum: 1, maximum: 30, default: 1 } }, required: [] }
- src/tools.js:230-231 (registration)Registration in the tool dispatcher switch statement that routes calls to the currentStats handler.case 'thealeph_current_stats': return this.currentStats(params);
- src/tools.js:27-43 (registration)Tool definition registration in getToolDefinitions() method, including name, description, and schema.{ name: 'thealeph_current_stats', description: 'Get current API usage statistics for the last N days', inputSchema: { type: 'object', properties: { days: { type: 'integer', description: 'Number of days to retrieve statistics for (1-30)', minimum: 1, maximum: 30, default: 1 } }, required: [] } },
- src/client.js:79-83 (helper)API client helper method that makes the HTTP request to fetch current stats from The Aleph API.async getCurrentStats(days = 1) { return this.makeRequest('GET', '/monitoring/stats/current', { params: { days } }); }