Skip to main content
Glama
aws-samples

MCP Security Scanner

Official
by aws-samples

scan_directory_with_semgrep

Scan a project directory with Semgrep to find security vulnerabilities across supported source code files. Reports issues by severity threshold.

Instructions

Scan an entire project directory with Semgrep for security issues.

This tool scans all supported source code files in a directory for security vulnerabilities using Semgrep with security-focused rulesets.

Unlike scan_with_semgrep which scans code snippets, this tool scans the actual project directory to find issues across all supported files.

Supported languages:

  • Python, JavaScript, TypeScript, Java, Go, C/C++

  • C#, Ruby, PHP, Scala, Kotlin, Rust

  • And many more

Args: directory_path: Path to the directory to scan (relative or absolute) severity_threshold: Minimum severity level to report (LOW, MEDIUM, HIGH, CRITICAL)

Returns: A dictionary with security findings from Semgrep

Note: Semgrep must be installed and available in PATH. Install with: - pip: pip install semgrep - pipx: pipx install semgrep - homebrew: brew install semgrep

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
return_outputNoReturn full output instead of saving to file (default: False)
directory_pathYesPath to the directory to scan
severity_thresholdNoMinimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL)MEDIUM

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations, the description carries the full burden. It explains the scanning scope, ruleset focus, and return type, and notes Semgrep must be installed. However, the 'Returns' section conflicts with the schema's 'return_output' parameter (default false implies saving to file rather than returning), which is confusing and undermines transparency.

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 well-structured with clear sections for purpose, differentiation, supported languages, args, returns, and note. It is longer than minimal but each section adds value, such as the installation instructions. Front-loaded with the main purpose.

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?

For a moderately complex scanning tool with an output schema, the description covers core behavior, languages, and differences from sibling. However, the inconsistency about saving vs returning output (due to return_output) creates a completeness gap, and there is no mention of performance implications or failure modes.

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% for all three parameters. The description restates directory_path and severity_threshold but does not add substantial meaning beyond the schema. The installation note is helpful but not parameter-specific.

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 states a specific verb ('Scan') with a specific resource ('entire project directory with Semgrep') and clearly distinguishes itself from 'scan_with_semgrep' which scans code snippets. It also lists supported languages, making the scope evident.

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?

It explicitly contrasts with 'scan_with_semgrep' and gives installation prerequisites. While it doesn't discuss when to choose this over other directory scanners like scan_directory_with_bandit, it provides clear context for its own appropriate use.

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/aws-samples/sample-mcp-security-scanner'

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