|
44 | 44 | ForecastInput, |
45 | 45 | HttpResultsInput, |
46 | 46 | ListSessionsInput, |
| 47 | + ListSessionTasksInput, |
47 | 48 | MergeInput, |
48 | 49 | ProgressInput, |
49 | 50 | RankInput, |
@@ -1273,6 +1274,58 @@ async def everyrow_balance(ctx: EveryRowContext) -> list[TextContent]: |
1273 | 1274 | ] |
1274 | 1275 |
|
1275 | 1276 |
|
| 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 | + |
1276 | 1329 | @mcp.tool( |
1277 | 1330 | name="everyrow_cancel", |
1278 | 1331 | structured_output=False, |
|
0 commit comments