| 322 | } |
| 323 | |
| 324 | func NewTaskGetTool() coretools.Tool { |
| 325 | return newTaskTool("TaskGet", "Get the latest details for one direct child task by task_id, including status, result text, error text, usage, and lifecycle metadata.", TaskGetInput{}, func(_ context.Context, execCtx coretools.ExecutionContext, input any) (string, error) { |
| 326 | rt, scope, err := runtimeAndScope(execCtx) |
| 327 | if err != "" { |
| 328 | return err, nil |
| 329 | } |
| 330 | in := derefTaskGet(input) |
| 331 | record := rt.GetTask(in.TaskID, scope) |
| 332 | if record == nil { |
| 333 | return fmt.Sprintf("Error: Task '%s' was not found in the current scope.", in.TaskID), nil |
| 334 | } |
| 335 | return jsonString(serializeTaskPayload(record.ToMap())), nil |
| 336 | }) |
| 337 | } |
| 338 | |
| 339 | func NewTaskWaitTool() coretools.Tool { |
| 340 | return newTaskTool("TaskWait", "Block without busy-polling until all specified direct child tasks reach a stable state, or until timeout_seconds elapses.", TaskWaitInput{}, func(ctx context.Context, execCtx coretools.ExecutionContext, input any) (string, error) { |