Skip to main content
Glama
mfreeman451

JSON Logs MCP Server

by mfreeman451

list_log_files

Retrieve available log files with metadata from the JSON Logs MCP Server to access and manage logging data.

Instructions

List available log files with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Dispatch handler for the 'list_log_files' tool: calls log_analyzer.get_log_files() and returns JSON serialized list of log files.
    elif name == "list_log_files":
        results = log_analyzer.get_log_files()
        return [
            types.TextContent(
                type="text",
                text=json.dumps(results, indent=2, default=str)
            )
        ]
  • Registers the 'list_log_files' tool in list_tools() with description and empty input schema.
        types.Tool(
            name="list_log_files",
            description="List available log files with metadata",
            inputSchema={
                "type": "object",
                "properties": {}
            }
        )
    ]
  • Input schema for 'list_log_files' tool: empty object (no parameters).
    inputSchema={
        "type": "object",
        "properties": {}
    }
  • Main helper method invoked by the handler: refreshes log file cache and returns list of available log files with metadata.
    def get_log_files(self) -> List[Dict[str, Any]]:
        """Get list of available log files"""
        self._refresh_log_files()
        return list(self.log_files_cache.values())
  • Supporting method that scans the log directory for *.log* files, collects metadata (path, name, size, modified time), sorts by recency, and caches them.
    def _refresh_log_files(self):
        """Refresh the cache of available log files"""
        if not self.log_directory.exists():
            self.log_files_cache = {}
            return
    
        log_files = []
        for file_path in self.log_directory.glob("*.log*"):
            if file_path.is_file():
                stat = file_path.stat()
                log_files.append({
                    "path": str(file_path),
                    "name": file_path.name,
                    "size": stat.st_size,
                    "modified": datetime.fromtimestamp(stat.st_mtime).isoformat()
                })
    
        # Sort by modification time (newest first)
        log_files.sort(key=lambda x: x["modified"], reverse=True)
        self.log_files_cache = {f["name"]: f for f in log_files}
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 listing files with metadata, but fails to describe key traits like whether this is a read-only operation, if it requires authentication, any rate limits, pagination behavior, or what the metadata includes. This leaves significant gaps for a tool that interacts with log files.

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 action ('List available log files') and adds a useful detail ('with metadata') without any wasted words. It's appropriately sized for a simple tool with no parameters.

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 simplicity (0 parameters, no output schema), the description is minimally adequate. However, without annotations or an output schema, it lacks details on behavioral aspects like safety or return format, and doesn't address sibling tool differentiation, making it incomplete for optimal agent use.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately focuses on the tool's function without redundant parameter details, earning a high baseline score for this dimension.

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 with a specific verb ('List') and resource ('available log files'), and includes metadata as an output detail. However, it doesn't explicitly differentiate from sibling tools like 'query_logs' or 'aggregate_logs', which might also involve log file operations, preventing a perfect 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 'query_logs' or 'get_log_stats'. It lacks context about use cases, exclusions, or prerequisites, leaving the agent to infer usage from the tool name alone.

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/mfreeman451/json-logs-mcp-server'

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