Skip to main content
Glama

download_and_scan_package

Download package source from registries and scan all files for embedded licenses and copyrights, providing comprehensive analysis beyond metadata.

Instructions

Download package source from registry and perform comprehensive analysis.

⚠️ IMPORTANT: This tool CAN and WILL download source code from package registries!

Workflow (tries methods in order until sufficient data is collected):

  1. Primary: Use purl2notices to download and analyze (fastest, most comprehensive)

  2. Deep scan: If incomplete, use purl2src to get download URL → download artifact → run osslili for deep license scanning + upmex for metadata

    • Maven-specific: If license still missing for Maven packages, uses upmex with --registry --api clearlydefined to resolve parent POM licenses

  3. Online fallback: If still incomplete, use upmex --api clearlydefined/purldb for online metadata

What this tool does:

  • Downloads the actual package source code from npm/PyPI/Maven/etc registries

  • Performs comprehensive license and copyright analysis

  • Extracts package metadata (name, version, homepage, description)

  • Scans ALL source files for embedded licenses (not just package.json/setup.py/pom.xml)

  • Returns copyright statements found in actual source code

  • Maven packages: Automatically resolves parent POM licenses when not declared in package POM

When to use this tool:

  • Package metadata is incomplete or missing (e.g., "UNKNOWN" license in PyPI)

  • Need to verify what's ACTUALLY in the package files (not just metadata)

  • Want to analyze source code directly (not just manifests)

  • Security auditing - see actual package contents before approval

  • License compliance - find licenses embedded in source files

  • Need to extract copyright statements from source code

Real-world example: User asks: "Can you check if duckdb@0.2.3 has license info in the source code?"

  • PyPI metadata shows "UNKNOWN" license

  • This tool downloads the actual .whl/.tar.gz from PyPI

  • Scans ALL files in the package for license information

  • Finds licenses embedded in source code that aren't in metadata

  • Returns: {"method_used": "purl2notices", "declared_license": "UNKNOWN", "detected_licenses": ["CC0-1.0"], ...}

Performance:

  • Primary (purl2notices): 5-15 seconds (fastest)

  • Deep scan (download + osslili + upmex): 10-30 seconds

  • Online fallback (upmex --api): 2-5 seconds (but less complete)

Security note:

  • Downloads are verified against package checksums when available

  • Files are scanned but NOT executed

  • Temporary files are cleaned up unless keep_download=True

Args: purl: Package URL (e.g., "pkg:pypi/duckdb@0.2.3", "pkg:npm/express@4.21.2") keep_download: If True, keeps downloaded files for manual inspection (default: False)

Returns: Dictionary containing: - purl: The package URL analyzed - method_used: Which method succeeded ("purl2notices", "deep_scan", "online_fallback") - download_path: Where package was downloaded (if keep_download=True) - metadata: Package metadata (name, version, homepage, etc.) - declared_license: License from package metadata - detected_licenses: List of licenses found by scanning source files - copyright_statements: Copyright statements extracted from source - files_scanned: Number of files analyzed - scan_summary: Summary of what was found

Examples: # Check if package has license info in source code download_and_scan_package(purl="pkg:pypi/duckdb@0.2.3")

# Download and keep files for manual inspection
result = download_and_scan_package(
    purl="pkg:npm/suspicious-package@1.0.0",
    keep_download=True
)
print(f"Inspect files at: {result['download_path']}")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
purlYes
keep_downloadNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It is highly transparent: details the workflow (three methods in order), performance expectations, security notes (verified downloads, no execution, cleanup), and explicitly warns that it WILL download source code. This exceeds typical behavior disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is lengthy but well-organized with headers, bullet points, and sections. Each part adds value, and the structure aids readability. Could be slightly more concise, but the information density is justified given the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multi-step workflow, 2 parameters, detailed outputs), the description is complete. It covers all relevant aspects: workflow, use cases, examples, performance, security, and return values. Even with an output schema (context indicates it exists), the description enriches understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate fully. It explains 'purl' with examples and format, and 'keep_download' with its effect and default. Also details the return structure, adding significant meaning beyond the input schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Download package source from registry and perform comprehensive analysis.' It distinguishes itself from siblings like 'check_package' (which likely checks metadata) and 'scan_directory' (which scans local files) by emphasizing downloading and analyzing actual source files from registries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit 'When to use this tool' section with bullet points and a real-world example. While it doesn't list alternative tools explicitly, the context makes it clear when this tool is appropriate versus others that might check metadata or scan local directories.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SemClone/mcp-semclone'

If you have feedback or need assistance with the MCP directory API, please join our Discord server