Skip to main content
Glama
aws-samples

MCP Security Scanner

Official
by aws-samples

scan_with_bandit

Scan Python code with Bandit to uncover security vulnerabilities including SQL injection, hardcoded secrets, and unsafe functions.

Instructions

Scan Python code using Bandit for security issues.

This tool analyzes Python source code for common security issues using PyCQA's Bandit security linter. Bandit is specifically designed for Python and can detect issues like:

  • Use of insecure functions (pickle, eval, exec)

  • Hardcoded passwords and secrets

  • SQL injection vulnerabilities

  • Command injection risks

  • Weak cryptographic practices

  • Insecure random number generation

  • And many other Python-specific security issues

Args: code: The Python code content to analyze

Returns: A dictionary with scan results including found security issues

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython code content to scan

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are present, so the description carries the full burden. It explains the types of issues detected and the return shape, but does not mention whether the code is executed, whether the operation is read-only, or any limitations/edge cases. Adequate but not deeply transparent.

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 an opening summary, a bulleted list of security issues, and an Args/Returns section. There is slight redundancy between the first line and the second line, but the content is focused and easy to scan.

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 single-parameter tool, the description covers the input, the tool's purpose, representative issue types, and the return format. An output schema already exists, so detailed field documentation is unnecessary. It could have mentioned the directory-based sibling, but the scope is reasonably complete.

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 already describes the only parameter as 'Python code content to scan' with 100% coverage. The description's 'code: The Python code content to analyze' adds no meaningful new semantics, so a baseline 3 is appropriate.

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 a specific action ('Scan Python code using Bandit') with a resource ('Python source code') and a nameable tool (Bandit). The included vulnerability examples and Python-specific framing distinguish it from sibling tools like scan_with_semgrep or scan_directory_with_bandit.

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: it is for scanning Python code snippets/content for security issues. It does not explicitly describe when to use this tool versus directory-level scanners or alternative scanners, but the Python+code scope is well implied.

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