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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the action without behavioral details. It doesn't disclose whether this is a read-only operation, if it requires specific permissions, what the output format might be, or any rate limits, leaving significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a statistical analysis tool with no annotations and no output schema, the description is insufficient. It lacks details on what statistical methods are used, the format of results, or any constraints, making it incomplete for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond what the schema provides (100% coverage). It mentions 'confirmation history logs' but doesn't clarify how parameters like 'groupBy' relate to the analysis, so it meets the baseline for high schema coverage without adding extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('perform statistical analysis') and target resource ('confirmation history logs'), making the tool's purpose understandable. However, it doesn't differentiate from sibling tools like 'search_logs', which might also operate on logs but with different functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_logs' or other siblings. It lacks context about appropriate scenarios, prerequisites, or exclusions, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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