get_conan_licenses
Extract license information from Conan dependency graph for packages in host context. Supports conanfile path or direct package references.
Instructions
Collect license information for Conan package dependencies.
This tool uses `conan graph info` to extract license information from the dependency
graph for all packages.
Only packages in the "host" context are analyzed (build context packages are excluded
as they are build-time tools and not included in the final product).
You can either provide a path to a conanfile OR a list of package references to check.
At least one of these must be provided.
Use this tool when you need to:
- Search for licenses of the project
- Extract license information
- Check license information
Examples:
- get_conan_licenses(work_dir="/home/user/project", path="conanfile.py")
- get_conan_licenses(work_dir="~/my_project", path="conanfile.txt")
- get_conan_licenses(work_dir="/tmp", requires=["zlib/1.2.11"])
- get_conan_licenses(work_dir="/tmp", requires=["zlib/1.2.11", "fmt/10.0.0"])
Args:
work_dir: Working directory where the command should be executed.
This is the base directory from which all paths are resolved.
Always required.
path: Path to a folder containing a recipe or to a recipe file (conanfile.txt or conanfile.py).
This path is ALWAYS relative to work_dir. Optional if requires is provided.
requires: List of package references to check licenses for (e.g., ["zlib/1.2.11", "fmt/10.0.0"]).
Each reference will be passed as a --requires flag to conan graph info.
Optional if path is provided. At least one of path or requires must be provided.
remote: Optional remote name to search in (searches all remotes if not specified)
build_profile: Profile to the build context.
host_profile: Profile to the host context.
Returns:
List of dictionaries, each containing:
- "ref": Package reference (string)
- "licenses": List of license strings (always a list, empty if no license specified)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| work_dir | Yes | Working directory where the command should be executed. This is the base directory from which all paths are resolved. Always required. | |
| path | No | Path to the folder containing the recipe of the project or to a recipe file conanfile.txt/.py. Optional if requires is provided. | |
| requires | No | List of package references to check licenses for (e.g., ['zlib/1.2.11', 'fmt/10.0.0']). Each reference will be passed as a --requires flag. Optional if path is provided. | |
| remote | No | Remote name. Omit to search in all remotes. | |
| build_profile | No | Profile to the build context. | |
| host_profile | No | Profile to the host context. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |