Skip to main content
Glama

Diff two package.json/lockfile snapshots

diff_dependencies
Read-only

Compare two snapshots of a package.json, package-lock.json (v1-v3), yarn.lock (classic or Berry) or pnpm-lock.yaml (e.g. before/after a PR; formats can differ) and report added, removed and changed packages. Lockfiles cover the full resolved graph, so transitive-only changes are caught; npm aliases are followed (actualName). Up to 100 added/changed packages are checked in detail. Ideal for a CI gate.

Per added/changed package:

  • installScriptIntroduced: a preinstall/install/postinstall script the old version lacked — the shape of a compromised-maintainer release. prepare never runs on a registry install, so it is excluded; installScriptKeysIntroduced lists every new key, prepare included.

  • sourceIntegrityChanged: the same version now resolves to a different tarball URL or hash, or a bump moved to another host (ordinary bumps are not flagged). A same-version swap is changeType: "source-swap".

  • identityMismatch: the tarball is a different package or version than declared; tarballName/tarballVersion say what really installs, and the vulnerability fields describe that.

  • vulnerabilityDelta (introduced/fixed/still-vulnerable/still-clean) plus the findings, each with isMalware.

Project-level: projectLifecycleChanges diffs the project's own root install scripts (package.json only; a PR that only adds a root postinstall changes no dependency), and overridesChanges diffs overrides/resolutions/pnpm.overrides, from package.json or between two pnpm-lock.yaml files (removing one can let a vulnerable version back in). Both count toward flaggedCount. Read comparisonNote when the two snapshots differ in format. Install-script checks are presence-only; use analyze_install_script to see what a script does.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterYesRaw file content of the "after" snapshot — a package.json, package-lock.json (npm v1-v3), yarn.lock (classic v1 or Berry), or pnpm-lock.yaml. Format is auto-detected; before/after may be different formats.
beforeYesRaw file content of the "before" snapshot — a package.json, package-lock.json (npm v1-v3), yarn.lock (classic v1 or Berry), or pnpm-lock.yaml. Format is auto-detected; before/after may be different formats.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
addedYes
changedYes
removedYes
summaryYes
truncatedYes
totalAddedYes
afterFormatYes
beforeFormatYes
flaggedCountYes
totalChangedYes
totalRemovedYes
comparisonNoteYes
enrichmentNoteYes
truncationNoteYes
overridesChangesYes
projectLifecycleChangesYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • changedOutput schema / properties / added / items / properties / changeType / anyOf
      Previous value: -[
      -  {
      -    "enum": [
      -      "upgrade",
      -      "downgrade",
      -      "unresolved"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "upgrade",
      +      "downgrade",
      +      "unresolved",
      +      "source-swap"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedOutput schema / properties / added / items / properties / identityMismatch
      Added value: +{
      +  "description": "The lockfile tarball is a different package/version than declared; tarballName/tarballVersion say what is really installed, and the vulnerability fields describe that.",
      +  "type": [
      +    "boolean",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / tarballName
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / tarballVersion
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / vulnerabilities / items / properties / isMalware
      Added value: +{
      +  "description": "Confirmed-malicious package (MAL-* id/alias or CWE-506), not an ordinary vulnerability: remove it, do not patch.",
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / added / items / properties / vulnerabilities / items / required
      Previous value: -[
      -  "id",
      -  "summary",
      -  "severity",
      -  "aliases",
      -  "publishedAt",
      -  "fixedVersion",
      -  "npmscanUrl"
      -]New value: +[
      +  "id",
      +  "summary",
      +  "severity",
      +  "aliases",
      +  "publishedAt",
      +  "fixedVersion",
      +  "isMalware",
      +  "npmscanUrl"
      +]
    • changedOutput schema / properties / added / items / required
      Previous value: -[
      -  "name",
      -  "actualName",
      -  "npmscanUrl",
      -  "beforeVersion",
      -  "afterVersion",
      -  "coexistingVersions",
      -  "changeType",
      -  "hasInstallScript",
      -  "installScriptIntroduced",
      -  "installScriptKeys",
      -  "installScriptKeysIntroduced",
      -  "sourceIntegrityChanged",
      -  "resolvedUrl",
      -  "integrity",
      -  "isVulnerable",
      -  "highestSeverity",
      -  "vulnerabilities",
      -  "vulnerabilityDelta",
      -  "resolutionNote"
      -]New value: +[
      +  "name",
      +  "actualName",
      +  "npmscanUrl",
      +  "beforeVersion",
      +  "afterVersion",
      +  "coexistingVersions",
      +  "changeType",
      +  "hasInstallScript",
      +  "installScriptIntroduced",
      +  "installScriptKeys",
      +  "installScriptKeysIntroduced",
      +  "sourceIntegrityChanged",
      +  "identityMismatch",
      +  "tarballName",
      +  "tarballVersion",
      +  "resolvedUrl",
      +  "integrity",
      +  "isVulnerable",
      +  "highestSeverity",
      +  "vulnerabilities",
      +  "vulnerabilityDelta",
      +  "resolutionNote"
      +]
  2. Changed10 schema fields changed
    • addedOutput schema / properties / added / items / properties / actualName
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / integrity
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / resolvedUrl
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / sourceIntegrityChanged
      Added value: +{
      +  "type": [
      +    "boolean",
      +    "null"
      +  ]
      +}
    • changedOutput schema / properties / added / items / required
      Previous value: -[
      -  "name",
      -  "npmscanUrl",
      -  "beforeVersion",
      -  "afterVersion",
      -  "coexistingVersions",
      -  "changeType",
      -  "hasInstallScript",
      -  "installScriptIntroduced",
      -  "installScriptKeys",
      -  "installScriptKeysIntroduced",
      -  "isVulnerable",
      -  "highestSeverity",
      -  "vulnerabilities",
      -  "vulnerabilityDelta",
      -  "resolutionNote"
      -]New value: +[
      +  "name",
      +  "actualName",
      +  "npmscanUrl",
      +  "beforeVersion",
      +  "afterVersion",
      +  "coexistingVersions",
      +  "changeType",
      +  "hasInstallScript",
      +  "installScriptIntroduced",
      +  "installScriptKeys",
      +  "installScriptKeysIntroduced",
      +  "sourceIntegrityChanged",
      +  "resolvedUrl",
      +  "integrity",
      +  "isVulnerable",
      +  "highestSeverity",
      +  "vulnerabilities",
      +  "vulnerabilityDelta",
      +  "resolutionNote"
      +]
    • addedOutput schema / properties / overridesChanges
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "changed": {
      +          "additionalProperties": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "after": {
      +                "type": "string"
      +              },
      +              "before": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "before",
      +              "after"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "object"
      +        },
      +        "introduced": {
      +          "additionalProperties": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "removed": {
      +          "additionalProperties": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "introduced",
      +        "removed",
      +        "changed"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / projectLifecycleChanges
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "changed": {
      +          "additionalProperties": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "after": {
      +                "type": "string"
      +              },
      +              "before": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "before",
      +              "after"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "object"
      +        },
      +        "introduced": {
      +          "additionalProperties": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "removed": {
      +          "additionalProperties": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        }
      +      },
      +      "required": [
      +        "introduced",
      +        "removed",
      +        "changed"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / removed / items / properties / actualName
      Added value: +{
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
    • changedOutput schema / properties / removed / items / required
      Previous value: -[
      -  "name",
      -  "version",
      -  "npmscanUrl"
      -]New value: +[
      +  "name",
      +  "actualName",
      +  "version",
      +  "npmscanUrl"
      +]
    • changedOutput schema / required
      Previous value: -[
      -  "summary",
      -  "beforeFormat",
      -  "afterFormat",
      -  "comparisonNote",
      -  "added",
      -  "removed",
      -  "changed",
      -  "totalAdded",
      -  "totalRemoved",
      -  "totalChanged",
      -  "flaggedCount",
      -  "truncated",
      -  "truncationNote",
      -  "enrichmentNote"
      -]New value: +[
      +  "summary",
      +  "beforeFormat",
      +  "afterFormat",
      +  "comparisonNote",
      +  "added",
      +  "removed",
      +  "changed",
      +  "totalAdded",
      +  "totalRemoved",
      +  "totalChanged",
      +  "flaggedCount",
      +  "truncated",
      +  "truncationNote",
      +  "enrichmentNote",
      +  "projectLifecycleChanges",
      +  "overridesChanges"
      +]
  3. Changed3 schema fields changed
    • addedOutput schema / properties / added / items / properties / installScriptKeys
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "enum": [
      +          "preinstall",
      +          "install",
      +          "postinstall",
      +          "prepare"
      +        ],
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / added / items / properties / installScriptKeysIntroduced
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "enum": [
      +          "preinstall",
      +          "install",
      +          "postinstall",
      +          "prepare"
      +        ],
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • changedOutput schema / properties / added / items / required
      Previous value: -[
      -  "name",
      -  "npmscanUrl",
      -  "beforeVersion",
      -  "afterVersion",
      -  "coexistingVersions",
      -  "changeType",
      -  "hasInstallScript",
      -  "installScriptIntroduced",
      -  "isVulnerable",
      -  "highestSeverity",
      -  "vulnerabilities",
      -  "vulnerabilityDelta",
      -  "resolutionNote"
      -]New value: +[
      +  "name",
      +  "npmscanUrl",
      +  "beforeVersion",
      +  "afterVersion",
      +  "coexistingVersions",
      +  "changeType",
      +  "hasInstallScript",
      +  "installScriptIntroduced",
      +  "installScriptKeys",
      +  "installScriptKeysIntroduced",
      +  "isVulnerable",
      +  "highestSeverity",
      +  "vulnerabilities",
      +  "vulnerabilityDelta",
      +  "resolutionNote"
      +]
  4. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare read-only/non-destructive, yet the description adds substantial behavioral depth: transitive-only changes are caught via full resolved graph, npm aliases are followed, only up to 100 added/changed packages are inspected in detail, and each flagged field (installScriptIntroduced, sourceIntegrityChanged, identityMismatch, vulnerabilityDelta) is explained with its semantics. This goes well beyond the annotations.

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?

Front-loaded core purpose followed by clearly scoped bullet points for each reported field, each sentence carrying real semantic content. It is dense and re-explains some return fields despite an output schema existing, but the structure keeps it navigable.

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?

For a two-snapshot diff tool, the description covers formats, edge cases, per-field meaning, project-level checks, and the comparisonNote caveat, while the output schema handles return structure. An agent has everything needed to invoke and interpret it correctly.

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

Parameters4/5

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

Schema coverage is 100%, so the schema already documents both params; the description adds the practical framing that the two snapshots represent before/after (e.g. a PR) and that formats are auto-detected and may differ. This is modest added meaning over the schema's own text.

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?

Opens with a specific verb+resource: compare two snapshots, listing all supported formats (package.json, package-lock v1-v3, yarn.lock, pnpm-lock.yaml) and stating the output (added, removed, changed packages). This is unmistakable against siblings like analyze_transitive_dependencies or compare_packages.

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?

'Ideal for a CI gate' names a concrete usage context, and it routes the agent to analyze_install_script for script-body inspection, clarifying the boundary of this tool. It stops short of explicit when-not conditions, but the alternative reference is clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources