MCPcopy Create free account
hub / github.com/compozy/agh / handleTasksCancel

Method handleTasksCancel

internal/extension/host_api_tasks.go:215–239  ·  view source on GitHub ↗
(ctx context.Context, raw json.RawMessage)

Source from the content-addressed store, hash-verified

213}
214
215func (h *HostAPIHandler) handleTasksCancel(ctx context.Context, raw json.RawMessage) (any, error) {
216 var params hostAPITaskCancelParams
217 if err := decodeHostAPIParams(raw, &params); err != nil {
218 return nil, err
219 }
220 taskID := strings.TrimSpace(params.ID)
221 if taskID == "" {
222 return nil, invalidParamsRPCError(errors.New("id is required"))
223 }
224
225 manager, actor, err := h.taskManagerAndActor(ctx)
226 if err != nil {
227 return nil, err
228 }
229 cancelReq, err := cancelTaskFromRequest(params.CancelTaskRequest)
230 if err != nil {
231 return nil, err
232 }
233
234 record, err := manager.CancelTask(ctx, taskID, cancelReq, actor)
235 if err != nil {
236 return nil, mapTaskRPCError(taskID, err)
237 }
238 return taskPayloadFromTask(record), nil
239}
240
241func (h *HostAPIHandler) handleTasksRuns(ctx context.Context, raw json.RawMessage) (any, error) {
242 var params hostAPITaskRunsParams

Callers

nothing calls this directly

Calls 7

taskManagerAndActorMethod · 0.95
decodeHostAPIParamsFunction · 0.85
invalidParamsRPCErrorFunction · 0.85
mapTaskRPCErrorFunction · 0.85
taskPayloadFromTaskFunction · 0.85
cancelTaskFromRequestFunction · 0.70
CancelTaskMethod · 0.65

Tested by

no test coverage detected