TOOL_NAME = "ozzie_direct_print_skill"
TOOL_DESCRIPTION = """Prints a given file to the default Windows printer using win32print."""
TOOL_ARGS = '{"file_path":{"type":"string","description":"Path to the file to print"}}'

from tools._std import tool_ok, tool_error  # noqa: E402

def run(args: dict) -> str:
    import os, win32print, win32api
    file_path = args.get("file_path")
    if not file_path or not os.path.isfile(file_path):
        return f"Error: file not found: {file_path}"
    try:
        printer_name = win32print.GetDefaultPrinter()
        win32api.ShellExecute(0, "print", file_path, f"/d:{printer_name}", None, 0)
        return f"Print command sent to printer: {printer_name}"
    except Exception as e:
        return f"Printing failed: {e}"
