Skip to main content
Glama
mako10k

MCP-Confirm

by mako10k

analyze_logs

Perform statistical analysis on confirmation history logs by specifying a date range and grouping data by type, success, hour, or day.

Instructions

Perform statistical analysis on confirmation history logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endDateNoEnd date for analysis (ISO 8601 format)
groupByNoGroup analysis by fieldconfirmationType
startDateNoStart date for analysis (ISO 8601 format)

Implementation Reference

  • Main handler function for the analyze_logs tool. Parses arguments, reads and filters log entries by date, calculates statistics, groups by specified field, formats analysis, and returns formatted text response.
    private async handleAnalyzeLogs(args: Record<string, unknown>) { try { const startDate = typeof args.startDate === "string" ? args.startDate : undefined; const endDate = typeof args.endDate === "string" ? args.endDate : undefined; const groupBy = typeof args.groupBy === "string" ? args.groupBy : "confirmationType"; const entries = await this.readLogEntries(); const filteredEntries = this.filterByDateRange( entries, startDate, endDate ); const stats = this.calculateBasicStats(filteredEntries); const groupedData = this.groupLogsByField(filteredEntries, groupBy); const groupAnalysis = this.formatGroupAnalysis(groupedData); const analysisText = this.formatAnalysisResult( stats, groupAnalysis, groupBy, startDate, endDate ); return { content: [ { type: "text", text: analysisText, }, ], }; } catch (error) { return this.createErrorResponse( `Log analysis failed: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Tool definition including name, description, and input schema for date filtering and grouping options.
    private createAnalyzeLogsTool(): Tool { return { name: "analyze_logs", description: "Perform statistical analysis on confirmation history logs", inputSchema: { type: "object", properties: { startDate: { type: "string", description: "Start date for analysis (ISO 8601 format)", format: "date-time", }, endDate: { type: "string", description: "End date for analysis (ISO 8601 format)", format: "date-time", }, groupBy: { type: "string", description: "Group analysis by field", enum: ["confirmationType", "success", "hour", "day"], default: "confirmationType", }, }, }, }; }
  • src/index.ts:231-242 (registration)
    Tool registration in the list of all available tools returned by getToolDefinitions().
    private getToolDefinitions(): Tool[] { return [ this.createAskYesNoTool(), this.createConfirmActionTool(), this.createClarifyIntentTool(), this.createVerifyUnderstandingTool(), this.createCollectRatingTool(), this.createElicitCustomTool(), this.createSearchLogsTool(), this.createAnalyzeLogsTool(), ]; }
  • src/index.ts:516-537 (registration)
    Dispatch logic in executeToolCall that routes 'analyze_logs' calls to the handleAnalyzeLogs handler.
    private async executeToolCall(name: string, args: Record<string, unknown>) { switch (name) { case "ask_yes_no": return await this.handleAskYesNo(args); case "confirm_action": return await this.handleConfirmAction(args); case "clarify_intent": return await this.handleClarifyIntent(args); case "verify_understanding": return await this.handleVerifyUnderstanding(args); case "collect_rating": return await this.handleCollectRating(args); case "elicit_custom": return await this.handleElicitCustom(args); case "search_logs": return await this.handleSearchLogs(args); case "analyze_logs": return await this.handleAnalyzeLogs(args); default: throw new Error(`Unknown tool: ${name}`); } }
  • Helper function to group log entries by specified field (confirmationType, success, hour, day) used in analysis.
    private groupLogsByField( entries: ConfirmationLogEntry[], field: string ): Record<string, ConfirmationLogEntry[]> { const groups: Record<string, ConfirmationLogEntry[]> = {}; entries.forEach((entry) => { let key: string; switch (field) { case "confirmationType": key = entry.confirmationType; break; case "success": key = entry.success ? "Success" : "Failed"; break; case "hour": key = new Date(entry.timestamp).getHours().toString().padStart(2, "0") + ":00"; break; case "day": key = new Date(entry.timestamp).toISOString().split("T")[0]; break; default: key = "Unknown"; } if (!groups[key]) { groups[key] = []; } groups[key].push(entry); }); return groups; }

Other Tools

Related 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/mako10k/mcp-confirm'

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