run_python
Execute Python code to perform any task: HTTP requests, data processing, file operations, system commands, image manipulation, and more with auto-install of needed packages.
Instructions
Execute Python code to accomplish ANY task.
This is a universal tool - write Python to do what you need:
HTTP requests (requests, httpx, aiohttp)
Parse HTML (beautifulsoup4, lxml)
Process data (pandas, json, csv)
File operations (pathlib, shutil)
System commands (subprocess)
Images (Pillow, opencv)
And anything else Python can do!
Args: code: Python code to execute. Use print() for output. description: Brief task description (for logging) timeout: Max execution time in seconds auto_install: Auto-install missing packages
Returns: Execution result with stdout, stderr, status, and any generated images
Example: code = ''' import requests resp = requests.get("https://api.github.com/users/octocat") data = resp.json() print(f"User: {data['login']}") print(f"Repos: {data['public_repos']}") '''
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "run_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| description | No | ||
| timeout | No | ||
| auto_install | No |