Skip to main content
Glama
truaxki
by truaxki

read-logs

Retrieve logged conversation variations from the database to analyze statistical patterns and unusual events in conversation structure.

Instructions

Retrieve logged conversation variations from the database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitYesMaximum number of logs to retrieve
start_dateNoFilter logs after this date (ISO format YYYY-MM-DDTHH:MM:SS)
end_dateNoFilter logs before this date (ISO format YYYY-MM-DDTHH:MM:SS)
full_detailsNoIf true, show all fields; if false, show only context summaries

Implementation Reference

  • Handler for the 'read-logs' tool: parses arguments (limit, full_details), calls db.get_logs(), formats logs into a formatted table, and returns as TextContent. Handles errors.
    elif name == "read-logs":
        if not arguments:
            return [types.TextContent(type="text", text="No arguments provided")]
        
        limit = min(max(arguments.get("limit", 10), 1), 100)
        full_details = arguments.get("full_details", False)
        
        try:
            logs = db.get_logs(limit=limit, full_details=full_details)
            
            if not logs:
                return [types.TextContent(type="text", text="No logs found")]
            
            # Create compact table header with adjusted widths
            header = ["ID", "Time", "Prob", "Type", "Context"]
            separator = "-" * 90  # Increased overall width
            table = [separator]
            table.append(" | ".join([
                f"{h:<4}" if h == "ID" else
                f"{h:<12}" if h == "Time" else
                f"{h:<6}" if h == "Prob" or h == "Type" else
                f"{h:<45}"  # Increased context width
                for h in header
            ]))
            table.append(separator)
            
            # Create compact rows with adjusted widths
            for log in logs:
                time_str = str(log[1])[5:16]  # Extract MM-DD HH:MM
                context = str(log[8])[:42] + "..." if len(str(log[8])) > 42 else str(log[8])  # Increased context length
                row = [
                    str(log[0])[:4],          # ID
                    time_str,                 # Time
                    str(log[5])[:6],          # Prob
                    str(log[4])[:6],          # Type
                    context                   # Truncated context
                ]
                table.append(" | ".join([
                    f"{str(cell):<4}" if i == 0 else  # ID
                    f"{str(cell):<12}" if i == 1 else  # Time
                    f"{str(cell):<6}" if i in [2, 3] else  # Prob and Type
                    f"{str(cell):<45}"  # Context
                    for i, cell in enumerate(row)
                ]))
            
            return [types.TextContent(type="text", text="\n".join(table))]
            
        except sqlite3.Error as e:
            return [types.TextContent(type="text", text=f"Database error: {str(e)}")]
        except Exception as e:
            return [types.TextContent(type="text", text=f"Error: {str(e)}")]
  • Registration of the 'read-logs' tool in the list_tools handler, including description and JSON schema for input validation (limit required, optional filters).
    types.Tool(
        name="read-logs",
        description="Retrieve logged conversation variations from the database.",
        inputSchema={
            "type": "object",
            "properties": {
                "limit": {
                    "type": "integer",
                    "description": "Maximum number of logs to retrieve",
                    "default": 10,
                    "minimum": 1,
                    "maximum": 100
                },
                "start_date": {
                    "type": "string",
                    "description": "Filter logs after this date (ISO format YYYY-MM-DDTHH:MM:SS)"
                },
                "end_date": {
                    "type": "string",
                    "description": "Filter logs before this date (ISO format YYYY-MM-DDTHH:MM:SS)"
                },
                "full_details": {
                    "type": "boolean",
                    "description": "If true, show all fields; if false, show only context summaries",
                    "default": False
                }
            },
            "required": ["limit"]
        }
    ),
  • Helper method in LogDatabase class that executes a parameterized SQL query to fetch recent logs from 'chat_monitoring' table, with optional date filters, ordered by timestamp DESC, limited by count. Note: full_details param not used in query (possibly vestigial).
    def get_logs(self, 
                 limit: int = 10,
                 start_date: Optional[datetime] = None,
                 end_date: Optional[datetime] = None,
                 full_details: bool = False) -> list:
        """
        Retrieve logs with optional filtering.
        
        Args:
            limit (int): Maximum number of logs to retrieve
            start_date (datetime, optional): Filter by start date
            end_date (datetime, optional): Filter by end date
            full_details (bool): If True, return all fields; if False, return only context summary
            
        Returns:
            list: List of log entries
        """
        query = "SELECT * FROM chat_monitoring"
        params = []
        conditions = []
        
        if start_date:
            conditions.append("timestamp >= ?")
            params.append(start_date)
            
        if end_date:
            conditions.append("timestamp <= ?")
            params.append(end_date)
    
        if conditions:
            query += " WHERE " + " AND ".join(conditions)
    
        query += " ORDER BY timestamp DESC LIMIT ?"
        params.append(limit)
    
        try:
            with sqlite3.connect(self.db_path) as conn:
                cursor = conn.cursor()
                cursor.execute(query, params)
                return cursor.fetchall()
        except sqlite3.Error as e:
            print(f"Database error: {str(e)}")
            return []
        except Exception as e:
            print(f"Error: {str(e)}")
            return []
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions retrieval but fails to specify if this is a read-only operation, what permissions are needed, or details about rate limits or pagination. This leaves 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 purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output format, leaving room for improvement in completeness.

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 input schema has 100% description coverage, clearly documenting all four parameters with details like defaults and formats. The description adds no additional meaning beyond the schema, so it meets the baseline score of 3 without compensating for any gaps.

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 ('retrieve') and resource ('logged conversation variations from the database'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'log-query' or 'read_query', which might have overlapping functionality, so it misses the highest score.

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 such as 'log-query' or 'read_query', nor does it mention any prerequisites or exclusions. This lack of context leaves the agent without clear usage instructions.

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/truaxki/mcp-variance-log'

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