MCPcopy
hub / github.com/docker/docker-agent / deleteTask

Method deleteTask

pkg/tools/builtin/tasks/tasks.go:396–423  ·  view source on GitHub ↗
(_ context.Context, params DeleteTaskArgs)

Source from the content-addressed store, hash-verified

394}
395
396func (t *ToolSet) deleteTask(_ context.Context, params DeleteTaskArgs) (*tools.ToolCallResult, error) {
397 t.mu.Lock()
398 defer t.mu.Unlock()
399
400 store := t.load()
401 if _, ok := store.Tasks[params.ID]; !ok {
402 return tools.ResultError("task not found: " + params.ID), nil
403 }
404
405 for id, task := range store.Tasks {
406 filtered := make([]string, 0, len(task.Dependencies))
407 for _, d := range task.Dependencies {
408 if d != params.ID {
409 filtered = append(filtered, d)
410 }
411 }
412 task.Dependencies = filtered
413 store.Tasks[id] = task
414 }
415
416 delete(store.Tasks, params.ID)
417
418 if err := t.save(store); err != nil {
419 return tools.ResultError(err.Error()), nil
420 }
421
422 return tools.ResultJSON(map[string]string{"deleted": params.ID}), nil
423}
424
425func (t *ToolSet) listTasks(_ context.Context, params ListTasksArgs) (*tools.ToolCallResult, error) {
426 t.mu.Lock()

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
saveMethod · 0.95
ResultErrorFunction · 0.92
ResultJSONFunction · 0.92
LockMethod · 0.45
UnlockMethod · 0.45
ErrorMethod · 0.45