Skip to main content
Glama
mako10k

MCP-Confirm

by mako10k

search_logs

Search confirmation history logs using filters like date range, confirmation type, success status, and response time to analyze AI-user interaction patterns.

Instructions

Search confirmation history logs with various filters and pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordNoSearch keyword in message content
confirmationTypeNoFilter by confirmation type (confirmation, rating, clarification, verification, yes_no, custom)
startDateNoStart date filter (ISO 8601 format)
endDateNoEnd date filter (ISO 8601 format)
successNoFilter by success status
timedOutNoFilter by timeout status
minResponseTimeNoMinimum response time in milliseconds
maxResponseTimeNoMaximum response time in milliseconds
pageNoPage number for pagination (1-based)
pageSizeNoNumber of entries per page

Implementation Reference

  • The primary handler function for the 'search_logs' tool. It parses the input arguments, validates and structures them into LogSearchParams, calls the core searchLogs function, formats the results into a user-friendly markdown text response with pagination info, and handles errors.
      private async handleSearchLogs(args: Record<string, unknown>) {
        try {
          const searchParams: LogSearchParams = {
            keyword: typeof args.keyword === "string" ? args.keyword : undefined,
            confirmationType:
              typeof args.confirmationType === "string"
                ? args.confirmationType
                : undefined,
            startDate:
              typeof args.startDate === "string" ? args.startDate : undefined,
            endDate: typeof args.endDate === "string" ? args.endDate : undefined,
            success: typeof args.success === "boolean" ? args.success : undefined,
            timedOut:
              typeof args.timedOut === "boolean" ? args.timedOut : undefined,
            minResponseTime:
              typeof args.minResponseTime === "number"
                ? args.minResponseTime
                : undefined,
            maxResponseTime:
              typeof args.maxResponseTime === "number"
                ? args.maxResponseTime
                : undefined,
            page: typeof args.page === "number" ? args.page : 1,
            pageSize:
              typeof args.pageSize === "number" ? Math.min(args.pageSize, 100) : 10,
          };
    
          const result = await this.searchLogs(searchParams);
    
          const formatEntry = (entry: ConfirmationLogEntry, index: number) => {
            const timestamp = new Date(entry.timestamp).toLocaleString();
            const responseTime = `${entry.responseTimeMs}ms`;
            const status = entry.success ? "āœ… Success" : "āŒ Failed";
            const action = entry.response.action;
    
            return `**${index + 1}.** ${timestamp} [${entry.confirmationType}]
    ${status} - ${action} (${responseTime})
    Message: ${entry.request.message.substring(0, 100)}${entry.request.message.length > 100 ? "..." : ""}
    ${entry.error ? `Error: ${entry.error}` : ""}`;
          };
    
          const entriesText = result.entries
            .map((entry, index) =>
              formatEntry(entry, (result.currentPage - 1) * result.pageSize + index)
            )
            .join("\n\n");
    
          const paginationInfo = `\n\nšŸ“Š **Search Results**
    Total: ${result.totalCount} entries
    Page: ${result.currentPage}/${result.totalPages}
    Showing: ${result.entries.length} entries`;
    
          return {
            content: [
              {
                type: "text",
                text: `šŸ” **Confirmation Log Search Results**\n\n${entriesText}${paginationInfo}`,
              },
            ],
          };
        } catch (error) {
          return this.createErrorResponse(
            `Log search failed: ${error instanceof Error ? error.message : String(error)}`
          );
        }
      }
  • Core helper function that executes the log search logic: reads log entries from file, applies all filters (keyword, type, dates, success, timeout, response times), sorts newest first, handles pagination, and returns structured LogSearchResult.
    private async searchLogs(params: LogSearchParams): Promise<LogSearchResult> {
      const entries = await this.readLogEntries();
    
      // Apply filters
      const filteredEntries = this.filterLogEntries(entries, params);
    
      // Sort by timestamp (newest first)
      filteredEntries.sort(
        (a, b) =>
          new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
      );
    
      // Pagination
      const page = params.page || 1;
      const pageSize = params.pageSize || 10;
      const totalCount = filteredEntries.length;
      const totalPages = Math.ceil(totalCount / pageSize);
      const startIndex = (page - 1) * pageSize;
      const endIndex = startIndex + pageSize;
      const paginatedEntries = filteredEntries.slice(startIndex, endIndex);
    
      return {
        entries: paginatedEntries,
        totalCount,
        currentPage: page,
        totalPages,
        pageSize,
      };
    }
  • Defines the Tool object for 'search_logs' including name, description, and detailed inputSchema specifying all searchable parameters with types, descriptions, enums, and constraints.
    private createSearchLogsTool(): Tool {
      return {
        name: "search_logs",
        description:
          "Search confirmation history logs with various filters and pagination",
        inputSchema: {
          type: "object",
          properties: {
            keyword: {
              type: "string",
              description: "Search keyword in message content",
            },
            confirmationType: {
              type: "string",
              description:
                "Filter by confirmation type (confirmation, rating, clarification, verification, yes_no, custom)",
              enum: [
                "confirmation",
                "rating",
                "clarification",
                "verification",
                "yes_no",
                "custom",
              ],
            },
            startDate: {
              type: "string",
              description: "Start date filter (ISO 8601 format)",
              format: "date-time",
            },
            endDate: {
              type: "string",
              description: "End date filter (ISO 8601 format)",
              format: "date-time",
            },
            success: {
              type: "boolean",
              description: "Filter by success status",
            },
            timedOut: {
              type: "boolean",
              description: "Filter by timeout status",
            },
            minResponseTime: {
              type: "number",
              description: "Minimum response time in milliseconds",
            },
            maxResponseTime: {
              type: "number",
              description: "Maximum response time in milliseconds",
            },
            page: {
              type: "number",
              description: "Page number for pagination (1-based)",
              minimum: 1,
              default: 1,
            },
            pageSize: {
              type: "number",
              description: "Number of entries per page",
              minimum: 1,
              maximum: 100,
              default: 10,
            },
          },
        },
      };
    }
  • src/index.ts:231-242 (registration)
    Registers the 'search_logs' tool by including it (via createSearchLogsTool()) in the list of available tools returned for ListTools requests.
    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)
    Tool dispatch switch statement that handles routing for 'search_logs' calls to the specific handleSearchLogs function.
    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}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions 'pagination', it doesn't describe the return format, what fields are included in search results, error conditions, rate limits, or authentication requirements. For a search tool with 10 parameters and no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 front-loads the core purpose. Every word earns its place: 'Search' (verb), 'confirmation history logs' (resource), 'with various filters and pagination' (key capabilities). There's no redundancy or unnecessary elaboration.

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 (10 parameters, no annotations, no output schema), the description is insufficiently complete. It doesn't explain what the search returns (e.g., log entries with specific fields), how results are ordered, error handling, or performance characteristics. For a search tool with rich filtering options, more context about the output and behavioral traits is needed to guide effective 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?

Schema description coverage is 100%, meaning all parameters are well-documented in the input schema itself. The description adds marginal value by mentioning 'various filters and pagination', which aligns with the schema parameters but doesn't provide additional syntax, format details, or usage examples beyond what's already in the schema descriptions. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: 'Search confirmation history logs with various filters and pagination'. It specifies the verb ('search'), resource ('confirmation history logs'), and scope ('with various filters and pagination'). However, it doesn't explicitly differentiate this search tool from sibling tools like 'analyze_logs', which might have overlapping 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. It doesn't mention sibling tools like 'analyze_logs' or explain the difference between searching logs and other confirmation-related tools (e.g., 'ask_yes_no', 'confirm_action'). There's no context about prerequisites, typical use cases, or exclusions.

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