Initial commit

This commit is contained in:
moosecrap committed 2026-11-22 04:45:52 -08:00
commit 52ddc6ba9a
27 files changed
+2166

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
import time
import datetime
from pathlib import Path
from typing import List, Dict, Any, Optional
class ToolError(Exception):
"""Custom exception for tool-related errors to be caught by the MCP server."""
pass
def format_relative_time(timestamp: float) -> str:
"""Converts a timestamp to a human-readable relative format."""
now = time.time()
diff = now - timestamp
seconds = int(diff)
if seconds < 0:
return "In the future"
if seconds < 60:
return "Just now"
minutes = seconds // 60
if minutes < 60:
return f"{minutes}m ago"
hours = minutes // 60
if hours < 24:
return f"{hours}h ago"
days = hours // 24
if days == 1:
return "Yesterday"
if days < 30:
return f"{days}d ago"
months = days // 30
if months < 12:
return f"{months}mo ago"
dt = datetime.datetime.fromtimestamp(timestamp)
return dt.strftime('%Y-%m-%d')