Skip to main content
Glama
pholex

Qinglong MCP Server

by pholex

list_qinglong_tasks

Retrieve all scheduled tasks from Qinglong Panel to monitor and manage automated scripts and subscriptions.

Instructions

查询青龙面板中的所有定时任务列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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": {}
        }
    },
  • Input schema for the 'list_qinglong_tasks' tool, which requires no parameters (empty properties).
    "inputSchema": {
        "type": "object",
        "properties": {}
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pholex/qinglong-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server