Skip to main content
Glama
mako10k

MCP-Confirm

by mako10k

analyze_logs

Analyze confirmation history logs to identify patterns in user interactions, success rates, and temporal trends for protocol optimization.

Instructions

Perform statistical analysis on confirmation history logs

Input Schema

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

Implementation Reference

  • Main handler function for the analyze_logs tool. Parses arguments, reads and filters log entries, computes statistics and grouped analysis, formats the result, and returns it as tool output.
    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 (parameters for date range and grouping).
    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)
    Registers the analyze_logs tool in the list of available tools by calling createAnalyzeLogsTool().
    private getToolDefinitions(): Tool[] { return [ this.createAskYesNoTool(), this.createConfirmActionTool(), this.createClarifyIntentTool(), this.createVerifyUnderstandingTool(), this.createCollectRatingTool(), this.createElicitCustomTool(), this.createSearchLogsTool(), this.createAnalyzeLogsTool(), ]; }
  • src/index.ts:517-537 (registration)
    Dispatch registration in executeToolCall switch statement that routes analyze_logs calls to handleAnalyzeLogs.
    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) for 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; }

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