Cleanup
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user