Skip to main content
Glama
bivex

Scancode License Analysis Tool for MCP

by bivex

Analyze License File (Legal Breakdown)

mcp_ScancodeMCP_analyze_license_file

Analyze software licenses in files to identify obligations, risks, and compatibility issues using Scancode data for compliance.

Instructions

Clause-by-clause legal analysis of all licenses detected in a file, including obligations, risks, and compatibility.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathsYesAn array of file paths to analyze. Can be a single file path for individual analysis.
linesToReadNoNumber of lines to read from each file (default: 100).
scannedDataBasePathNoThe base absolute path for resolving relative license paths (default: 'C:\Users\Admin\Desktop\LICENSE_MANAGER\').

Implementation Reference

  • index.ts:34-64 (registration)
    Registration of the 'mcp_ScancodeMCP_analyze_license_file' tool using server.registerTool, including schema and inline handler function.
    server.registerTool(
      "mcp_ScancodeMCP_analyze_license_file",
      {
        title: "Analyze License File (Legal Breakdown)",
        description: "Clause-by-clause legal analysis of all licenses detected in a file, including obligations, risks, and compatibility.",
        inputSchema: {
          filePaths: z.array(z.string()).describe("An array of file paths to analyze. Can be a single file path for individual analysis."),
          linesToRead: z.number().int().min(1).optional().describe("Number of lines to read from each file (default: 100)."),
          scannedDataBasePath: z.string().optional().describe("The base absolute path for resolving relative license paths (default: 'C:\\Users\\Admin\\Desktop\\LICENSE_MANAGER\\').")
        },
      },
      async ({ filePaths, linesToRead, scannedDataBasePath }) => {
        if (!licenseData?.problematic_licenses) {
          return { content: [{ type: "text", text: "License data not loaded or no problematic licenses found." }] };
        }
    
        const effectiveLinesToRead = linesToRead ?? 100;
        const effectiveScannedDataBasePath = scannedDataBasePath ?? "C:\\Users\\Admin\\Desktop\\LICENSE_MANAGER\\";
    
        if (!filePaths?.length) {
          return { content: [{ type: "text", text: "Please provide 'filePaths' to analyze." }] };
        }
    
        let overallReport = '';
    
        for (const currentFilePath of filePaths) {
          overallReport += await processFileForLicenseAnalysis(currentFilePath, effectiveLinesToRead, effectiveScannedDataBasePath);
        }
        return { content: [{ type: "text", text: overallReport.trim() }] };
      }
    );
  • index.ts:45-63 (handler)
    The handler function for the tool, which processes multiple file paths by calling the helper processFileForLicenseAnalysis and aggregates reports.
    async ({ filePaths, linesToRead, scannedDataBasePath }) => {
      if (!licenseData?.problematic_licenses) {
        return { content: [{ type: "text", text: "License data not loaded or no problematic licenses found." }] };
      }
    
      const effectiveLinesToRead = linesToRead ?? 100;
      const effectiveScannedDataBasePath = scannedDataBasePath ?? "C:\\Users\\Admin\\Desktop\\LICENSE_MANAGER\\";
    
      if (!filePaths?.length) {
        return { content: [{ type: "text", text: "Please provide 'filePaths' to analyze." }] };
      }
    
      let overallReport = '';
    
      for (const currentFilePath of filePaths) {
        overallReport += await processFileForLicenseAnalysis(currentFilePath, effectiveLinesToRead, effectiveScannedDataBasePath);
      }
      return { content: [{ type: "text", text: overallReport.trim() }] };
    }
  • Input schema defined using Zod validators for the tool parameters: filePaths (array of strings), linesToRead (optional number), scannedDataBasePath (optional string).
    inputSchema: {
      filePaths: z.array(z.string()).describe("An array of file paths to analyze. Can be a single file path for individual analysis."),
      linesToRead: z.number().int().min(1).optional().describe("Number of lines to read from each file (default: 100)."),
      scannedDataBasePath: z.string().optional().describe("The base absolute path for resolving relative license paths (default: 'C:\\Users\\Admin\\Desktop\\LICENSE_MANAGER\\').")
    },
  • Core helper function that performs license analysis for a single file: reads snippet, resolves path, finds matching licenses, generates legal report using legalSummaryForLicense.
    async function processFileForLicenseAnalysis(currentFilePath: string, effectiveLinesToRead: number, effectiveScannedDataBasePath: string): Promise<string> {
      const fileContentSnippet = await readFirstNLines(currentFilePath, effectiveLinesToRead);
      let report = `\n--- File Content Snippet for ${currentFilePath} ---\n${fileContentSnippet}\n`;
    
      let pathForLookup = currentFilePath;
      if (path.isAbsolute(currentFilePath)) {
        pathForLookup = path.relative(effectiveScannedDataBasePath, currentFilePath);
      }
      pathForLookup = pathForLookup.replace(/\\/g, '/');
    
      const found: { name: string, score: number }[] = findLicensesForFile(pathForLookup);
    
      if (found.length === 0) {
        report += `No problematic licenses found for file: ${currentFilePath}\n\n`;
      } else {
        let licReport = `Legal Analysis for ${currentFilePath}:\n`;
        for (const lic of found) {
          licReport += `\n---\nLicense: ${lic.name}\nScore: ${lic.score}\n`;
          licReport += await legalSummaryForLicense(lic.name);
        }
        report += `${licReport}\n\n`;
      }
      return report;
    }
  • Helper function that searches the loaded licenseData for problematic licenses matching the given file path.
    function findLicensesForFile(pathForLookup: string): { name: string, score: number }[] {
      const found: { name: string, score: number }[] = [];
      for (const category in licenseData?.problematic_licenses ?? {}) {
        for (const item of licenseData?.problematic_licenses?.[category] ?? []) {
          if (item.file?.toLowerCase() === pathForLookup?.toLowerCase()) {
            found.push({ name: item.name, score: item.score });
          }
        }
      }
      return found;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'clause-by-clause legal analysis' but does not disclose behavioral traits such as computational intensity, rate limits, authentication needs, or what happens with invalid file paths. For a tool with no annotations and three parameters, this leaves significant gaps in understanding its operation.

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 a single, efficient sentence that front-loads the core purpose ('Clause-by-clause legal analysis') and lists key outputs. Every word earns its place with no redundancy or unnecessary details, 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.

Completeness3/5

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

Given the tool's complexity (legal analysis with 3 parameters) and lack of annotations and output schema, the description is incomplete. It covers the purpose but misses behavioral context, usage guidelines, and output details. It's adequate as a minimum viable description but has clear gaps for effective agent use.

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 100%, so the schema already documents all three parameters thoroughly. The description does not add any meaning beyond what the schema provides (e.g., it doesn't explain how 'linesToRead' affects analysis or the purpose of 'scannedDataBasePath'). Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('clause-by-clause legal analysis') and resource ('all licenses detected in a file'), with explicit outputs ('obligations, risks, and compatibility'). It distinguishes from sibling tools like 'compare_license_compatibility' and 'summarize_license_risks' by focusing on detailed file-level analysis rather than comparison or summary.

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

Usage Guidelines3/5

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

The description implies usage for detailed license analysis in files, but does not explicitly state when to use this tool versus alternatives like 'get_license_clause_summary' or 'list_high_risk_files'. No guidance is provided on prerequisites, exclusions, or specific scenarios where this tool is preferred over siblings.

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/bivex/scancodeMCP'

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