Skip to main content
Glama

package_trends

Read-only

Analyze npm and PyPI package metadata including version history, release frequency, and last update dates to assess ecosystem activity and dependency health.

Instructions

Look up npm and PyPI package metadata — version history, release cadence, last updated. Use to gauge ecosystem activity around a tool or dependency. Supports comma-separated list of packages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packagesYesPackage name(s) e.g. 'langchain' or 'npm:zod,pypi:fastapi'
max_lengthNo

Implementation Reference

  • The implementation of the `packageTrendsAdapter` function which fetches package metadata from npm and PyPI registries.
    export async function packageTrendsAdapter(options: ExtractOptions): Promise<AdapterResult> {
      // Sanitize package input
      const raw_input = sanitizePackages(options.url.replace(/^https?:\/\//, "").trim());
    
      // Parse ecosystem prefix
      const parts = raw_input.split(",").map((s) => s.trim());
      const results: string[] = [];
      let latestDate: string | null = null;
    
      for (const pkg of parts) {
        const isExplicitPypi = pkg.startsWith("pypi:");
        const isExplicitNpm = pkg.startsWith("npm:");
        const pkgName = pkg.replace(/^(pypi:|npm:)/, "");
    
        // Try npm
        if (!isExplicitPypi) {
          try {
            const npmRes = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkgName)}`, {
              headers: { Accept: "application/json" },
            });
            if (npmRes.ok) {
              const npmData = await npmRes.json() as {
                name: string;
                description?: string;
                "dist-tags"?: { latest?: string };
                time?: Record<string, string>;
                homepage?: string;
                keywords?: string[];
                repository?: { url?: string };
              };
    
              const latestVersion = npmData["dist-tags"]?.latest ?? "unknown";
              const modified = npmData.time?.modified ?? null;
              const created = npmData.time?.created ?? null;
              const versions = Object.keys(npmData.time ?? {}).filter((k) => !["created", "modified"].includes(k)).length;
    
              if (modified && (!latestDate || modified > latestDate)) latestDate = modified;
    
              results.push([
                `📦 [npm] ${npmData.name}`,
                `Latest version: ${latestVersion}`,
                `Total versions: ${versions}`,
                `Description: ${npmData.description ?? "N/A"}`,
                `Keywords: ${npmData.keywords?.join(", ") ?? "none"}`,
                `Created: ${created ?? "unknown"}`,
                `Last updated: ${modified ?? "unknown"}`,
                `Homepage: ${npmData.homepage ?? "N/A"}`,
              ].join("\n"));
              continue;
            }
          } catch { /* fall through to PyPI */ }
        }
    
        // Try PyPI
        if (!isExplicitNpm) {
          try {
            const pypiRes = await fetch(`https://pypi.org/pypi/${encodeURIComponent(pkgName)}/json`);
            if (pypiRes.ok) {
              const pypiData = await pypiRes.json() as {
                info: {
                  name: string;
                  version: string;
                  summary?: string;
                  keywords?: string;
                  home_page?: string;
                  project_urls?: Record<string, string>;
                };
                releases?: Record<string, unknown[]>;
                urls?: Array<{ upload_time: string }>;
              };
    
              const info = pypiData.info;
              const releaseCount = Object.keys(pypiData.releases ?? {}).length;
              const latestUpload = pypiData.urls?.[0]?.upload_time ?? null;
    
              if (latestUpload && (!latestDate || latestUpload > latestDate)) latestDate = latestUpload;
    
              results.push([
                `🐍 [PyPI] ${info.name}`,
                `Latest version: ${info.version}`,
                `Total releases: ${releaseCount}`,
                `Description: ${info.summary ?? "N/A"}`,
                `Keywords: ${info.keywords ?? "none"}`,
                `Last release: ${latestUpload ?? "unknown"}`,
                `Homepage: ${info.home_page ?? info.project_urls?.Homepage ?? "N/A"}`,
              ].join("\n"));
              continue;
            }
          } catch { /* not found */ }
        }
    
        results.push(`❌ Package not found on npm or PyPI: ${pkgName}`);
      }
    
      return {
        raw: results.join("\n\n").slice(0, options.maxLength ?? 5000),
        content_date: latestDate,
        freshness_confidence: latestDate ? "high" : "low",
      };
    }
  • src/server.ts:143-148 (registration)
    Registration of the `package_trends` tool in the main server file.
    // ─── Tool: package_trends ────────────────────────────────────────────────────
    server.registerTool(
      "package_trends",
      {
        description:
          "Look up npm and PyPI package metadata — version history, release cadence, last updated. Use to gauge ecosystem activity around a tool or dependency. Supports comma-separated list of packages.",
Behavior4/5

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

Annotations indicate read-only and open-world operations, which the description aligns with by describing a lookup function. The description adds valuable context beyond annotations by specifying supported ecosystems (npm and PyPI), the ability to handle comma-separated lists, and the purpose of gauging activity, though it lacks details on rate limits or authentication needs.

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

Conciseness5/5

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

The description is front-loaded with the core purpose, followed by usage context and parameter details in two efficient sentences. Every sentence adds value without redundancy, making it highly concise and well-structured.

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

Completeness4/5

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

Given the tool's moderate complexity (2 parameters, no output schema), the description covers the purpose, usage, and key parameter semantics adequately. However, it lacks details on output format or error handling, which would enhance completeness for an agent invoking the tool.

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

Parameters3/5

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

Schema description coverage is 50%, with the 'packages' parameter well-described in both schema and description. The description adds meaning by explaining the comma-separated list format and ecosystem prefixes, but does not clarify the 'max_length' parameter's purpose or units, leaving a gap in parameter understanding.

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 specific action ('Look up npm and PyPI package metadata') and resources ('package metadata — version history, release cadence, last updated'), with explicit ecosystem scope. It distinguishes itself from sibling tools by focusing on package metadata rather than changelogs, company data, or other extraction domains.

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?

The description provides clear context for when to use this tool ('to gauge ecosystem activity around a tool or dependency'), but does not explicitly state when not to use it or name specific alternatives among sibling tools like 'extract_changelog' or 'extract_github' that might overlap in some contexts.

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/PrinceGabriel-lgtm/freshcontext-mcp'

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