-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add everyrow_list_session_tasks MCP tool #243
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
7346be4
4d9427b
7c79c1c
2d5b208
4aaae3a
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 |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ | |
| ForecastInput, | ||
| HttpResultsInput, | ||
| ListSessionsInput, | ||
| ListSessionTasksInput, | ||
| MergeInput, | ||
| ProgressInput, | ||
| RankInput, | ||
|
|
@@ -1273,6 +1274,58 @@ async def everyrow_balance(ctx: EveryRowContext) -> list[TextContent]: | |
| ] | ||
|
|
||
|
|
||
| @mcp.tool( | ||
| name="everyrow_list_session_tasks", | ||
| structured_output=False, | ||
| annotations=ToolAnnotations( | ||
| title="List Tasks in a Session", | ||
| readOnlyHint=True, | ||
| destructiveHint=False, | ||
| idempotentHint=True, | ||
| openWorldHint=False, | ||
| ), | ||
| ) | ||
| async def everyrow_list_session_tasks( | ||
| params: ListSessionTasksInput, ctx: EveryRowContext | ||
| ) -> list[TextContent]: | ||
| """List all tasks in a session with their IDs, statuses, and types. | ||
|
|
||
| Use this to find task IDs for a session so you can display previous results | ||
| with mcp__display__show_task(task_id, label). | ||
| """ | ||
| client = _get_client(ctx) | ||
|
|
||
| try: | ||
| response = await client.get_async_httpx_client().request( | ||
| method="get", | ||
| url=f"/sessions/{params.session_id}/tasks", | ||
| ) | ||
| response.raise_for_status() | ||
| data = response.json() | ||
| except Exception as e: | ||
| return [TextContent(type="text", text=f"Error listing session tasks: {e!r}")] | ||
|
|
||
| tasks = data.get("tasks", []) | ||
| if not tasks: | ||
| return [ | ||
| TextContent( | ||
| type="text", text=f"No tasks found in session {params.session_id}." | ||
| ) | ||
| ] | ||
|
|
||
| lines = [f"Found {len(tasks)} task(s) in session {params.session_id}:\n"] | ||
| for t in tasks: | ||
| artifact = ( | ||
| f" | output_artifact: {t['artifact_id']}" if t.get("artifact_id") else "" | ||
| ) | ||
| lines.append( | ||
| f"- **{t['task_type']}** (task_id: {t['task_id']})\n" | ||
| f" Status: {t['status']} | Created: {t['created_at']}{artifact}" | ||
|
Comment on lines
+1322
to
+1323
This comment was marked as outdated.
Sorry, something went wrong.
Contributor
Author
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. CLAUDE: Not a real issue. These fields ( The 👎 |
||
| ) | ||
|
|
||
| return [TextContent(type="text", text="\n".join(lines))] | ||
|
|
||
|
|
||
| @mcp.tool( | ||
| name="everyrow_cancel", | ||
| structured_output=False, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much work would it be to have the input artifact id(s) as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very doable — the
input_artifactsandcontext_artifactsuuid[] columns already exist on the tasks table, andget_tasks_for_session()already fetches them. Just need to add two optional fields toSessionTaskItemand pass them through in the handler (~5 lines in the engine + MCP tool update). Will do as a follow-up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(That was Claude)