MCPcopy Create free account
hub / github.com/astercloud/aster / listTasks

Method listTasks

pkg/tools/builtin/task.go:130–155  ·  view source on GitHub ↗

listTasks 列出所有任务

()

Source from the content-addressed store, hash-verified

128
129// listTasks 列出所有任务
130func (t *TaskTool) listTasks() (any, error) {
131 executor := GetGlobalTaskExecutor()
132 tasks := executor.ListTasks()
133
134 taskList := make([]map[string]any, 0, len(tasks))
135 for _, task := range tasks {
136 taskInfo := map[string]any{
137 "task_id": task.TaskID,
138 "subagent": task.Subagent,
139 "status": task.Status,
140 "start_time": task.StartTime.Unix(),
141 "duration": task.Duration.String(),
142 }
143 if task.Error != "" {
144 taskInfo["error"] = task.Error
145 }
146 taskList = append(taskList, taskInfo)
147 }
148
149 return map[string]any{
150 "ok": true,
151 "action": "list",
152 "total_tasks": len(taskList),
153 "tasks": taskList,
154 }, nil
155}
156
157// getTaskStatus 获取任务状态
158func (t *TaskTool) getTaskStatus(taskID string) (any, error) {

Callers 1

ExecuteMethod · 0.95

Calls 3

GetGlobalTaskExecutorFunction · 0.85
ListTasksMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected