Cheatsheet¶
Quick reference card for AI agents using Contree MCP.
Tools at a Glance¶
Tool |
When to Use |
Cost |
|---|---|---|
|
Before importing anything |
Free |
|
Need new base image |
VM |
|
Local files needed in container |
Free |
|
Execute code |
VM |
|
Single file to container |
Free |
|
Extract file from container |
Free |
|
Check if image exists |
Free |
|
Name frequently-used images |
Free |
|
Explore container filesystem |
Free |
|
Read file from container |
Free |
|
Poll async operation |
Free |
|
Find running operations |
Free |
|
Wait for multiple ops |
Free |
|
Stop stuck operation |
Free |
|
Get documentation sections |
Free |
Common Workflows¶
Run Python Code¶
1. list_images(tag_prefix="python") → Check existing
2. import_image(docker://python:3.11) → If needed
3. rsync(source="/project", dest="/app") → Sync files
4. run(cmd, image, ds_id) → Execute
Install Dependencies¶
1. run(pip install ..., disposable=false) → Save image
2. Use result_image for subsequent commands
Parallel Execution¶
1. run(cmd1, wait=false) → op-1
2. run(cmd2, wait=false) → op-2
3. wait_operations([op-1, op-2]) → Get both results
Rollback¶
1. Save last good image UUID
2. If something breaks, use the saved UUID
3. No cleanup needed—images are immutable
Inspect Container (No VM)¶
1. list_files(image, path="/etc") → List directory
2. read_file(image, path="/etc/os-release") → Read file
Decision Quick Guide¶
Situation |
Action |
|---|---|
First time using an image |
|
Running existing code |
|
Installing packages |
|
Multiple independent tasks |
Use |
Long-running command |
Increase |
Large output expected |
Increase |
Need to save state |
|
One-off experiment |
|
Parameters Quick Reference¶
run¶
{
"command": "...", // Required
"image": "uuid", // Required
"directory_state_id": "ds-...", // From rsync
"disposable": true, // Discard changes (default)
"timeout": 30, // Seconds
"env": {"KEY": "value"}, // Environment
"wait": true // Sync execution (default)
}
rsync¶
{
"source": "/local/path", // Required
"destination": "/container/path", // Required
"exclude": ["__pycache__", ".git", ".venv", "node_modules"]
}
import_image¶
{
"registry_url": "docker://image:tag", // Required
"tag": "my-tag", // Optional, for frequent reuse
"wait": true // Sync (default)
}
Key Rules¶
Check before importing —
list_imagesfirstReuse directory_state_id — Valid for entire session
Use UUIDs directly — Only tag frequently-used images
One step per command — Easier rollback and debugging
Always exclude —
__pycache__,.git,.venv,node_modules
Error Recovery¶
Error |
Solution |
|---|---|
Image not found |
|
Directory state not found |
Re-run |
Command timed out |
Increase |
Output truncated |
Increase |
Operation stuck |
|
Resources (Read-Only)¶
URI Pattern |
Returns |
|---|---|
|
File contents |
|
Directory listing |
|
Parent-child history |
|
Documentation |
|
Command execution result |
|
Image import result |