Skip to main content
Glama

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}

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