Skip to main content
Glama
pholex

Qinglong MCP Server

by pholex

run_task_async

Start Qinglong Panel tasks asynchronously to initiate execution without waiting for completion, enabling parallel task management.

Instructions

异步启动任务,不等待执行完成

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes任务 ID

Implementation Reference

  • The handler logic for the 'run_task_async' tool. It extracts the task_id from arguments, authenticates with a Bearer token, sends a PUT request to the Qinglong API endpoint /open/crons/run with the task_id in the body to asynchronously start the task, and returns a success message or error based on the API response.
    elif tool_name == "run_task_async":
        task_id = arguments.get("task_id")
        try:
            url = f"{QINGLONG_URL}/open/crons/run"
            headers = {"Authorization": f"Bearer {token}"}
            data = [task_id]
            
            resp = requests.put(url, headers=headers, json=data, 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:
            response = {
                "jsonrpc": "2.0",
                "id": request["id"],
                "result": {"content": [{"type": "text", "text": f"任务 {task_id} 已成功启动"}]}
            }
        else:
            response = {
                "jsonrpc": "2.0",
                "id": request["id"],
                "error": {"code": -32603, "message": f"运行任务失败: {result}"}
            }
  • The input schema definition for the 'run_task_async' tool, specifying that it requires an integer 'task_id'.
    "inputSchema": {
        "type": "object",
        "properties": {
            "task_id": {"type": "integer", "description": "任务 ID"}
        },
        "required": ["task_id"]
    }
  • server.py:101-111 (registration)
    The registration of the 'run_task_async' tool in the tools/list response, including name, description, and input schema.
    {
        "name": "run_task_async",
        "description": "异步启动任务,不等待执行完成",
        "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