Aria2 json rpc

From lxyeternal/MalSkillBench · View interactive version

Aria2 json rpc is an AI agent skill from the GitHub repository lxyeternal/MalSkillBench. Interact with aria2 download manager via JSON-RPC 2.0. Manage downloads, query status, and control tasks through natural language commands. Use when working with aria2, download management, or torrent operations.

How to use this skill

Skill file

What This Skill Does

This skill enables you to control aria2 download manager through natural language commands:

How to Use (For AI Agents)

⚠️ CRITICAL: DO NOT manually construct JSON-RPC requests.

✅ ALWAYS use the Python scripts in the scripts/ directory.

⚠️ IMPORTANT: Use python3 command, NOT python (especially on macOS where python symlink doesn't exist)

Workflow (MUST FOLLOW)

Step 1: Check Configuration Status

Before executing any aria2 commands, ALWAYS check if configuration is ready:

python3 scripts/config_loader.py test

Step 2: Initialize Configuration (if needed)

If connection test fails, guide user to set up configuration:

# Recommended: User config (survives skill updates)
python3 scripts/config_loader.py init --user

# Alternative: Local config (project-specific)
python3 scripts/config_loader.py init --local

Then instruct user to edit the generated config file with their aria2 server details.

Step 3: Execute User Commands

Once configuration is ready, execute the requested aria2 operations.

Example Workflow

User: "download http://example.com/file.zip"

You execute:

# 1. Check configuration
python3 scripts/config_loader.py test

If test passes:

# 2. Execute download command
python3 scripts/rpc_client.py aria2.addUri '["http://example.com/file.zip"]'

You respond: "✓ Download started! GID: 2089b05ecca3d829"

If test fails:

Configuration not ready. Please initialize:
1. Run: python3 scripts/config_loader.py init --user
2. Edit ~/.config/aria2-skill/config.json with your aria2 server details
3. Run: python3 scripts/config_loader.py test (to verify)

Documentation Structure

For detailed execution instructions, see:

For aria2 method reference, see:

Common Commands Quick Reference

| User Intent | Command Example |

|-------------|----------------|

| Download a file | python3 scripts/rpc_client.py aria2.addUri '["http://example.com/file.zip"]' |

| Check status | python3 scripts/rpc_client.py aria2.tellStatus <GID> |

| List active downloads | python3 scripts/rpc_client.py aria2.tellActive |

| List stopped downloads | python3 scripts/rpc_client.py aria2.tellStopped 0 100 |

| Pause download | python3 scripts/rpc_client.py aria2.pause <GID> |

| Resume download | python3 scripts/rpc_client.py aria2.unpause <GID> |

| Show statistics | python3 scripts/rpc_client.py aria2.getGlobalStat |

| Show version | python3 scripts/rpc_client.py aria2.getVersion |

| Purge results | python3 scripts/rpc_client.py aria2.purgeDownloadResult |

For detailed usage and more commands, see execution-guide.md.

Available Scripts

Configuration

Scripts automatically load configuration from multiple sources with the following priority (highest to lowest):

Configuration Priority

  1. Environment Variables (highest priority - temporary override)
  1. Skill Directory Config (project-specific configuration)
  1. User Config Directory (global fallback, update-safe) 🆕
  1. Defaults (localhost:6800)

Configuration Options

Quick Setup (For AI Agents)

IMPORTANT: Always use Python scripts to manage configuration. Do NOT use shell commands directly.

Step 1: Check current configuration status

python3 scripts/config_loader.py show

Step 2: Initialize configuration if needed

User config (recommended - survives updates):

python3 scripts/config_loader.py init --user

Local config (project-specific):

python3 scripts/config_loader.py init --local

Step 3: Guide user to edit the config file

After initialization, the tool will display the config file path. Instruct user to edit it with their aria2 server details (host, port, secret, etc.).

Step 4: Verify configuration

python3 scripts/config_loader.py test

Example config file content:

{
  "host": "localhost",
  "port": 6800,
  "secret": "your-secret-token",
  "secure": false,
  "timeout": 30000
}

Configuration Management (For AI Agents)

Available Python scripts for configuration management:

# Check current configuration and source
python3 scripts/config_loader.py show

# Initialize user config (recommended - update-safe)
python3 scripts/config_loader.py init --user

# Initialize local config (project-specific)
python3 scripts/config_loader.py init --local

# Test connection to aria2 server
python3 scripts/config_loader.py test

Agent Workflow for Configuration Setup:

  1. Check if config exists: Run python3 scripts/config_loader.py show
  2. If config missing or invalid: Guide user to run python3 scripts/config_loader.py init --user
  3. User edits config: Tell user the file path and required fields (host, port, secret)
  4. Verify setup: Run python3 scripts/config_loader.py test
  5. Proceed with operations: Once test passes, execute user's aria2 commands

Advanced Configuration

Reverse Proxy Setup:

For reverse proxy setups like https://example.com:443/jsonrpc, the config file should contain:

{
  "host": "example.com",
  "port": 443,
  "path": "/jsonrpc",
  "secret": "your-secret-token",
  "secure": true
}

Environment Variables (for reference only):

Configuration can also be overridden via environment variables:

Note: Use Python scripts for configuration management. Environment variables are documented here for reference only.

Key Principles (For AI Agents)

  1. Never construct JSON-RPC requests manually
  2. Always call Python scripts via Bash tool using python3 (not python)
  3. Always check configuration before executing commands:
  1. Never run raw shell commands (mkdir, cat, export, etc.) directly
  1. Parse script output and format for users
  2. Refer to execution-guide.md when unsure

Supported Operations

Download Management

Monitoring

Configuration

Maintenance

Need Help?

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.