This commit is contained in:
2026-07-25 21:00:51 -07:00
parent f808f4d599
commit ca33869007
5 changed files with 44 additions and 39 deletions
+9
View File
@@ -1,5 +1,6 @@
import time
import datetime
import tomllib
from pathlib import Path
from typing import List, Dict, Any, Optional
@@ -8,6 +9,14 @@ class ToolError(Exception):
"""Custom exception for tool-related errors to be caught by the MCP server."""
pass
def load_toml(path: str) -> Dict[str, Any]:
"""Loads a TOML file into a dictionary."""
try:
with open(path, "rb") as f:
return tomllib.load(f)
except Exception as e:
raise ToolError(f"Failed to load config file {path}: {str(e)}")
def format_relative_time(timestamp: float) -> str:
"""Converts a timestamp to a human-readable relative format."""
now = time.time()