list_qinglong_tasks
Retrieve all scheduled tasks from Qinglong Panel to monitor and manage automated scripts and subscriptions.
Instructions
查询青龙面板中的所有定时任务列表
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_qinglong_tasks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:171-215 (handler)The handler function for the 'list_qinglong_tasks' tool. It retrieves the list of cron tasks from the Qinglong API endpoint /open/crons, formats the output with task details like ID, name, command, schedule, status, and last run time, and returns it as 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 the tools/list response, including name, description, and empty input schema.
{ "name": "list_qinglong_tasks", "description": "查询青龙面板中的所有定时任务列表", "inputSchema": { "type": "object", "properties": {} } }, - server.py:85-88 (schema)Input schema for the 'list_qinglong_tasks' tool, which requires no parameters (empty properties).
"inputSchema": { "type": "object", "properties": {} }