"""
Task: task00001-260207-08.00
작업: NotebookLM 노트북 목록 조회 테스트 (notebook_list API)
"""
import asyncio
import sys
import os

source_path = r"C:\Users\drumb\.gemini\antigravity\scratch\autoAIagent\notebooklm-mcp-source\src"
if source_path not in sys.path:
    sys.path.append(source_path)

from notebooklm_mcp.server import notebook_list

async def main():
    try:
        # If it's not awaitable, call it directly
        res = notebook_list.fn()
        # Handle both sync and async return
        if asyncio.iscoroutine(res):
            res = await res
            
        if res.get("status") == "success":
            print(f"COUNT:{res.get('count')}")
            for nb in res.get("notebooks", []):
                print(f"NB:{nb['title']}|{nb['id']}")
        else:
            print(f"ERROR:{res.get('error')}")
    except Exception as e:
        print(f"EXCEPTION:{str(e)}")

if __name__ == "__main__":
    asyncio.run(main())
