Ensure Collection
ensure_collectionInstalls an Ansible collection into a temporary session directory and pins the resolved version, skipping reinstall when that version is already present.
Instructions
Install a collection to a temporary directory for this session.
Installs once and pins the resolved version. Subsequent calls with the same namespace skip unless a different version is explicitly requested. If a different version is requested than currently installed, the collection will be reinstalled.
Returns dict with keys:
namespace: str — the collection namespace
version: str — the installed/active version (always set)
status: 'installed' (freshly installed or upgraded) or 'already_installed' (same version already present, no action taken)
message: str — human-readable summary including the active version
handle: str — opaque session handle; pass it as collection_handle to subsequent tool calls on remote connections On failure returns {"error": str}.
Pass collection_handle when re-invoking ensure_collection on a remote connection with a handle obtained from a prior call (e.g. to install an additional collection into the same session). Omit it on local stdio, or on remote when you want a brand-new session handle minted.
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": {
"collection_namespace": "<collection_namespace>"
},
"name": "ensure_collection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| version | No | Optional version (e.g. '4.1.0'). If omitted, installs latest and pins the resolved version. | |
| collection_handle | No | Session handle returned by ensure_collection. Omit on local stdio; required on remote. | |
| collection_namespace | Yes | Collection namespace (e.g. 'netbox.netbox') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |