MCPcopy Index your code
hub / github.com/plotly/dash / cancel_task

Function cancel_task

dash/mcp/tasks/tasks.py:174–193  ·  view source on GitHub ↗

Handle tasks/cancel — terminate the background job. Same underlying mechanism as the renderer's cancelJob query param.

(task_id: str)

Source from the content-addressed store, hash-verified

172
173
174def cancel_task(task_id: str) -> Any:
175 """Handle tasks/cancel — terminate the background job.
176
177 Same underlying mechanism as the renderer's cancelJob query param.
178 """
179 tool_name, job_id, _cache_key, created_at = parse_task_id(task_id)
180
181 manager = _get_callback_manager(tool_name)
182 if manager is None:
183 raise MCPError("No background callback manager configured.")
184
185 manager.terminate_job(job_id)
186
187 return CancelTaskResult(
188 taskId=task_id,
189 status="cancelled",
190 createdAt=created_at,
191 lastUpdatedAt=datetime.now(timezone.utc),
192 ttl=manager.expire * 1000 if manager.expire else None,
193 )

Callers 2

_process_mcp_messageFunction · 0.90
call_toolMethod · 0.90

Calls 4

MCPErrorClass · 0.90
parse_task_idFunction · 0.85
_get_callback_managerFunction · 0.70
terminate_jobMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…