Skip to main content
Glama

get_fix_commands

Generate safe upgrade commands for vulnerable packages to review before applying fixes. Returns npm install and pip install commands grouped by ecosystem.

Instructions

Get the safe upgrade commands for vulnerable packages WITHOUT executing them. Use this to show the user what will be changed before calling apply_fixes. Returns a list of commands grouped by ecosystem (npm install / pip install).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the project directory.
packagesNoOptional: only return fix commands for these package names. If omitted, returns all fixable packages.
severity_filterNoOnly return fixes for this severity or above. Default: all.

Implementation Reference

  • The handleGetFixCommands function retrieves fixable vulnerabilities and generates a table of commands to upgrade packages.
    async function handleGetFixCommands({ path: dir = '.', packages, severity_filter = 'all' }) {
      const absDir = resolve(dir);
      const result = await scanService(absDir, { noOsv: false });
      const sevOrder = { critical: 0, high: 1, moderate: 2, low: 3 };
      const filterRank = sevOrder[severity_filter] ?? 4;
    
      const fixable = getFixableGroups(result.vulns, packages, filterRank);
    
      if (fixable.length === 0) {
        return ok('No fixable vulnerabilities found' + (packages ? ` for packages: ${packages.join(', ')}` : '') + '.');
      }
    
      const lines = [
        `## Fix commands for ${result.name}`,
        '',
        `The following ${fixable.length} package(s) can be upgraded to fix CVEs:`,
        '',
        '| Package | Current | Safe version | Fixes | Command |',
        '|---------|---------|-------------|-------|---------|',
      ];
    
      for (const f of fixable) {
        lines.push(`| \`${f.name}\` | ${f.currentVersion} | **${f.fixVersion}** | ${f.cveCount} CVE(s) | \`${f.command}\` |`);
      }
    
      lines.push('');
      lines.push('⚠️ **Review before running.** Call `apply_fixes` with the package names you want to upgrade.');
      lines.push('');
      lines.push('**To apply all:** `apply_fixes({ path: "' + dir + '", packages: [' + fixable.map(f => `"${f.name}"`).join(', ') + '] })`');
    
      return ok(lines.join('\n'));
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates that this is a read-only operation ('WITHOUT executing them'), describes the return format ('Returns a list of commands grouped by ecosystem'), and hints at its safe nature ('safe upgrade commands'). However, it doesn't mention potential errors, rate limits, or authentication requirements.

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 extremely concise and well-structured in just two sentences. The first sentence states the purpose and key behavioral constraint, while the second explains usage and return format. Every word earns its place with no redundancy or fluff.

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?

For a tool with 3 parameters, 100% schema coverage, and no annotations or output schema, the description provides excellent context about the tool's purpose, usage, and return format. It effectively compensates for the lack of output schema by describing what's returned. The only minor gap is the absence of error handling or edge case information.

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?

The schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description doesn't add any additional parameter semantics beyond what's in the schema, but it does provide context about the tool's purpose that helps interpret the parameters. This meets the baseline for high schema coverage.

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 purpose: 'Get the safe upgrade commands for vulnerable packages WITHOUT executing them.' It specifies the verb ('Get'), resource ('safe upgrade commands'), and scope ('for vulnerable packages'), and distinguishes it from sibling apply_fixes by emphasizing it's for previewing changes rather than applying them.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'Use this to show the user what will be changed before calling apply_fixes.' It names the alternative tool (apply_fixes) and provides clear context for its preview purpose, making it easy to distinguish from siblings like scan_project or open_dashboard.

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/toan203/osv-ui'

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