Skip to main content
Glama
pholex

Qinglong MCP Server

by pholex

get_task_status

Check the execution status of scheduled tasks in Qinglong Panel by providing the task ID to monitor progress and results.

Instructions

获取青龙面板中指定任务的执行状态

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes任务 ID

Implementation Reference

  • Handler implementation for the get_task_status tool. Retrieves task status from Qinglong API endpoint /open/crons/{task_id}, maps status codes to human-readable text, and constructs a formatted output with task details including name, status, disabled/pinned flags, last run time, and last execution time.
    elif tool_name == "get_task_status":
        task_id = arguments.get("task_id")
        try:
            url = f"{QINGLONG_URL}/open/crons/{task_id}"
            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:
            cron = result["data"]
            status_map = {0: "运行中", 1: "空闲", 2: "禁用"}
            status = status_map.get(cron.get("status"), "未知")
            
            output = f"任务 {task_id} 状态信息:\n\n"
            output += f"名称: {cron.get('name')}\n"
            output += f"状态: {status}\n"
            output += f"是否禁用: {'是' if cron.get('isDisabled') == 1 else '否'}\n"
            output += f"是否置顶: {'是' if cron.get('isPinned') == 1 else '否'}\n"
            last_running = cron.get('last_running_time')
            output += f"上次运行时长: {last_running}秒\n" if last_running else "上次运行时长: 未运行\n"
            output += f"最后执行时间: {cron.get('last_execution_time', '未执行')}\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:123-133 (registration)
    Registration of the get_task_status tool in the tools/list method response, including name, description, and input schema requiring a task_id integer.
    {
        "name": "get_task_status",
        "description": "获取青龙面板中指定任务的执行状态",
        "inputSchema": {
            "type": "object",
            "properties": {
                "task_id": {"type": "integer", "description": "任务 ID"}
            },
            "required": ["task_id"]
        }
    },
  • Input schema for get_task_status tool: requires a single integer property 'task_id'.
    "inputSchema": {
        "type": "object",
        "properties": {
            "task_id": {"type": "integer", "description": "任务 ID"}
        },
        "required": ["task_id"]

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