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}`); } }

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