TOOL_NAME = "ozzie_print_skill"
TOOL_DESCRIPTION = """Prints a PDF file to the default Windows printer using win32print."""
TOOL_ARGS = '{"type":"object","properties":{"file_path":{"type":"string","description":"Path to the PDF file to print."}},"required":["file_path"]}'

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

import os
import win32print
import win32api

def run(args: dict) -> str:
    file_path = args.get("file_path")
    if not file_path or not os.path.isfile(file_path):
        return f"File not found: {file_path}"
    printer_name = win32print.GetDefaultPrinter()
    try:
        # Use ShellExecute to print the file
        win32api.ShellExecute(0, "print", file_path, f'/d:"{printer_name}"', ".", 0)
        return f"Print job submitted to {printer_name}"
    except Exception as e:
        return f"Error printing: {e}"
