Skip to main content
Glama

list_log_files

Retrieve and list available log files along with their metadata from the JSON Logs MCP Server for efficient log management and analysis.

Instructions

List available log files with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'list_log_files' tool: calls log_analyzer.get_log_files() and returns the JSON-formatted list of log files as TextContent.
    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 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": {} }
  • Core helper method that refreshes the log files cache and returns the 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())
  • Private helper that scans the log directory for *.log* files, collects metadata (path, name, size, modified), 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}

Other Tools

Related 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