list_qinglong_tasks
Retrieve all scheduled task lists from Qinglong Panel for monitoring and managing automated scripts and subscriptions.
Instructions
查询青龙面板中的所有定时任务列表
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:171-214 (handler)Handler for the list_qinglong_tasks tool. Fetches cron tasks from Qinglong /open/crons API, sorts by ID, formats detailed text output with ID, name, command, schedule, status, and last run time, returns as MCP text content.if tool_name == "list_qinglong_tasks": try: url = f"{QINGLONG_URL}/open/crons" headers = {"Authorization": f"Bearer {token}"} resp = requests.get(url, headers=headers, timeout=10) result = resp.json() except Exception as e: response = { "jsonrpc": "2.0", "id": request["id"], "error": {"code": -32603, "message": f"请求失败: {str(e)}"} } print(json.dumps(response), flush=True) continue if result.get("code") == 200: data = result["data"] crons = data.get("data", []) crons.sort(key=lambda x: x.get('id', 0)) total = data.get("total", 0) output = f"青龙面板: {QINGLONG_URL}\n共 {total} 个任务:\n\n" for cron in crons: output += f"ID: {cron.get('id')}\n" output += f"名称: {cron.get('name')}\n" output += f"命令: {cron.get('command')}\n" output += f"定时: {cron.get('schedule')}\n" output += f"状态: {'启用' if cron.get('isDisabled') == 0 else '禁用'}\n" last_running = cron.get('last_running_time') if last_running: output += f"上次运行时长: {last_running}秒\n" output += "-" * 50 + "\n" response = { "jsonrpc": "2.0", "id": request["id"], "result": {"content": [{"type": "text", "text": output}]} } else: response = { "jsonrpc": "2.0", "id": request["id"], "error": {"code": -32603, "message": f"获取任务列表失败: {result}"} }
- server.py:82-89 (registration)Registration of the list_qinglong_tasks tool in tools/list response, including schema (no input parameters).{ "name": "list_qinglong_tasks", "description": "查询青龙面板中的所有定时任务列表", "inputSchema": { "type": "object", "properties": {} } },