-
Notifications
You must be signed in to change notification settings - Fork 3
everyrow-cc-CLAUDE: Add everyrow_cancel MCP tool for task cancellation #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5e99ac9
07e5aa8
3ec4ebf
36fadf2
9fadd63
2c13d10
7312b69
ae51e9a
38af04a
bc738a1
59df0b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
|
|
||
| import pandas as pd | ||
| from everyrow.api_utils import handle_response | ||
| from everyrow.constants import EveryrowError | ||
| from everyrow.generated.api.tasks import ( | ||
| get_task_result_tasks_task_id_result_get, | ||
| get_task_status_tasks_task_id_status_get, | ||
|
|
@@ -27,6 +28,7 @@ | |
| single_agent_async, | ||
| ) | ||
| from everyrow.session import create_session, get_session_url | ||
| from everyrow.task import cancel_task | ||
| from mcp.types import TextContent, ToolAnnotations | ||
| from pydantic import BaseModel, create_model | ||
|
|
||
|
|
@@ -39,6 +41,7 @@ | |
| ) | ||
| from everyrow_mcp.models import ( | ||
| AgentInput, | ||
| CancelInput, | ||
| DedupeInput, | ||
| MergeInput, | ||
| ProgressInput, | ||
|
|
@@ -749,3 +752,47 @@ async def everyrow_results(params: ResultsInput) -> list[TextContent]: | |
|
|
||
| except Exception as e: | ||
| return [TextContent(type="text", text=f"Error retrieving results: {e!r}")] | ||
|
|
||
|
|
||
| @mcp.tool( | ||
| name="everyrow_cancel", | ||
| structured_output=False, | ||
| annotations=ToolAnnotations( | ||
| title="Cancel a Running Task", | ||
| readOnlyHint=False, | ||
| destructiveHint=True, | ||
| idempotentHint=False, | ||
| openWorldHint=False, | ||
| ), | ||
| ) | ||
| async def everyrow_cancel(params: CancelInput) -> list[TextContent]: | ||
| """Cancel a running everyrow task. Use when the user wants to stop a task that is currently processing.""" | ||
| if _app._client is None: | ||
| return [TextContent(type="text", text="Error: MCP server not initialized.")] | ||
| client = _app._client | ||
|
|
||
| task_id = params.task_id | ||
| try: | ||
| await cancel_task(task_id=UUID(task_id), client=client) | ||
| _clear_task_state() | ||
straeter marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return [ | ||
| TextContent( | ||
| type="text", | ||
| text=f"Cancelled task {task_id}.", | ||
| ) | ||
| ] | ||
| except EveryrowError as e: | ||
| _clear_task_state() | ||
| return [ | ||
| TextContent( | ||
| type="text", | ||
| text=f"Error cancelling task {task_id}: {e!r}", | ||
| ) | ||
| ] | ||
| except Exception as e: | ||
| return [ | ||
| TextContent( | ||
| type="text", | ||
| text=f"Error cancelling task {task_id}: {e!r}", | ||
| ) | ||
| ] | ||
|
Comment on lines
+792
to
+798
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The generic Suggested FixModify the generic Prompt for AI Agent |
||
Uh oh!
There was an error while loading. Please reload this page.