MCPcopy Index your code
hub / github.com/docker/docker-agent / nextTask

Method nextTask

pkg/tools/builtin/tasks/tasks.go:462–483  ·  view source on GitHub ↗
(_ context.Context, _ tools.ToolCall)

Source from the content-addressed store, hash-verified

460}
461
462func (t *ToolSet) nextTask(_ context.Context, _ tools.ToolCall) (*tools.ToolCallResult, error) {
463 t.mu.Lock()
464 defer t.mu.Unlock()
465
466 store := t.load()
467 var tasks []taskWithEffective
468 for _, task := range store.Tasks {
469 tasks = append(tasks, taskWithEffective{
470 Task: task,
471 EffectiveStatus: effectiveStatus(task, store.Tasks),
472 })
473 }
474 sortTasks(tasks)
475
476 for _, task := range tasks {
477 if task.EffectiveStatus != StatusBlocked && task.EffectiveStatus != StatusDone {
478 return tools.ResultJSON(task), nil
479 }
480 }
481
482 return tools.ResultSuccess("No actionable tasks. Everything is either done or blocked."), nil
483}
484
485func (t *ToolSet) addDependency(_ context.Context, params AddDependencyArgs) (*tools.ToolCallResult, error) {
486 t.mu.Lock()

Callers 2

TestTasksTool_NextTaskFunction · 0.80

Implementers 15

StartableToolSetpkg/tools/startable.go
fakeToolSetpkg/tools/named_test.go
stubDescriberpkg/tools/startable_test.go
stubToolSetpkg/tools/startable_test.go
flappyToolSetpkg/tools/startable_test.go
listFlappyToolSetpkg/tools/startable_test.go
reportingToolSetpkg/tools/startable_test.go
reportingStartOnlyToolSetpkg/tools/startable_test.go
recoveryFailingToolSetpkg/tools/startable_test.go
codeModeToolpkg/tools/codemode/codemode.go
testToolSetpkg/tools/codemode/codemode_test.go
Toolsetpkg/tools/a2a/a2a.go

Calls 7

loadMethod · 0.95
ResultJSONFunction · 0.92
ResultSuccessFunction · 0.92
effectiveStatusFunction · 0.85
sortTasksFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 2

TestTasksTool_NextTaskFunction · 0.64