MCPcopy
hub / github.com/agent0ai/agent-zero / process

Method process

api/scheduler_tasks_list.py:9–29  ·  view source on GitHub ↗

List all tasks in the scheduler with their types

(self, input: Input, request: Request)

Source from the content-addressed store, hash-verified

7
8class SchedulerTasksList(ApiHandler):
9 async def process(self, input: Input, request: Request) -> Output:
10 """
11 List all tasks in the scheduler with their types
12 """
13 try:
14 # Get timezone from input (do not set if not provided, we then rely on poll() to set it)
15 if timezone := input.get("timezone", None):
16 Localization.get().set_timezone(timezone)
17
18 # Get task scheduler
19 scheduler = TaskScheduler.get()
20 await scheduler.reload()
21
22 # Use the scheduler's convenience method for task serialization
23 tasks_list = scheduler.serialize_all_tasks()
24
25 return {"ok": True, "tasks": tasks_list}
26
27 except Exception as e:
28 PrintStyle.error(f"Failed to list tasks: {str(e)} {traceback.format_exc()}")
29 return {"ok": False, "error": f"Failed to list tasks: {str(e)} {traceback.format_exc()}", "tasks": []}

Callers

nothing calls this directly

Calls 5

set_timezoneMethod · 0.80
serialize_all_tasksMethod · 0.80
getMethod · 0.45
reloadMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected