Skip to content

Commit 65cf128

Browse files
nikosbosseclaude
andauthored
feat: add everyrow_list_session_tasks MCP tool (#243)
* feat: add everyrow_list_session_tasks MCP tool Calls GET /api/v0/sessions/{id}/tasks to list task IDs, statuses, and types for a session. Used by the agent to look up tasks for displaying previous results in the viz pane. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix ruff formatting in list_session_tasks Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add everyrow_list_session_tasks to manifest and test expected tools Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: rename artifact to output_artifact for clarity Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix ruff formatting for output_artifact line Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4a8616e commit 65cf128

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

everyrow-mcp/manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
"name": "everyrow_list_sessions",
7474
"description": "List everyrow sessions owned by the authenticated user (paginated)."
7575
},
76+
{
77+
"name": "everyrow_list_session_tasks",
78+
"description": "List all tasks in a session with their IDs, statuses, and types."
79+
},
7680
{
7781
"name": "everyrow_cancel",
7882
"description": "Cancel a running everyrow task. Use when the user wants to stop a task that is currently processing."

everyrow-mcp/src/everyrow_mcp/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,3 +741,11 @@ class ListSessionsInput(BaseModel):
741741
limit: int = Field(
742742
25, ge=1, le=1000, description="Max sessions per page (default 25, max 1000)"
743743
)
744+
745+
746+
class ListSessionTasksInput(BaseModel):
747+
"""Input for listing tasks in a session."""
748+
749+
model_config = ConfigDict(extra="forbid")
750+
751+
session_id: str = Field(description="The session ID to list tasks for")

everyrow-mcp/src/everyrow_mcp/tools.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
ForecastInput,
4545
HttpResultsInput,
4646
ListSessionsInput,
47+
ListSessionTasksInput,
4748
MergeInput,
4849
ProgressInput,
4950
RankInput,
@@ -1273,6 +1274,58 @@ async def everyrow_balance(ctx: EveryRowContext) -> list[TextContent]:
12731274
]
12741275

12751276

1277+
@mcp.tool(
1278+
name="everyrow_list_session_tasks",
1279+
structured_output=False,
1280+
annotations=ToolAnnotations(
1281+
title="List Tasks in a Session",
1282+
readOnlyHint=True,
1283+
destructiveHint=False,
1284+
idempotentHint=True,
1285+
openWorldHint=False,
1286+
),
1287+
)
1288+
async def everyrow_list_session_tasks(
1289+
params: ListSessionTasksInput, ctx: EveryRowContext
1290+
) -> list[TextContent]:
1291+
"""List all tasks in a session with their IDs, statuses, and types.
1292+
1293+
Use this to find task IDs for a session so you can display previous results
1294+
with mcp__display__show_task(task_id, label).
1295+
"""
1296+
client = _get_client(ctx)
1297+
1298+
try:
1299+
response = await client.get_async_httpx_client().request(
1300+
method="get",
1301+
url=f"/sessions/{params.session_id}/tasks",
1302+
)
1303+
response.raise_for_status()
1304+
data = response.json()
1305+
except Exception as e:
1306+
return [TextContent(type="text", text=f"Error listing session tasks: {e!r}")]
1307+
1308+
tasks = data.get("tasks", [])
1309+
if not tasks:
1310+
return [
1311+
TextContent(
1312+
type="text", text=f"No tasks found in session {params.session_id}."
1313+
)
1314+
]
1315+
1316+
lines = [f"Found {len(tasks)} task(s) in session {params.session_id}:\n"]
1317+
for t in tasks:
1318+
artifact = (
1319+
f" | output_artifact: {t['artifact_id']}" if t.get("artifact_id") else ""
1320+
)
1321+
lines.append(
1322+
f"- **{t['task_type']}** (task_id: {t['task_id']})\n"
1323+
f" Status: {t['status']} | Created: {t['created_at']}{artifact}"
1324+
)
1325+
1326+
return [TextContent(type="text", text="\n".join(lines))]
1327+
1328+
12761329
@mcp.tool(
12771330
name="everyrow_cancel",
12781331
structured_output=False,

everyrow-mcp/tests/test_mcp_e2e.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ async def test_list_tools(self, _http_state):
179179
"everyrow_classify",
180180
"everyrow_dedupe",
181181
"everyrow_forecast",
182+
"everyrow_list_session_tasks",
182183
"everyrow_list_sessions",
183184
"everyrow_merge",
184185
"everyrow_progress",

0 commit comments

Comments
 (0)