Skip to main content
Glama
vivashu27

SQL Injection MCP Server

by vivashu27

load_custom_payloads_from_file

Load custom SQL injection payloads from a file to use in scanning. Specify the injection type, database type, and cache name for later reuse.

Instructions

Load custom SQL injection payloads from a file.

Args: file_path: Absolute path to the payload file (one payload per line) injection_type: Injection type for loaded payloads database_type: Database type for loaded payloads name: Name to cache the payloads under for later use

Returns: Information about loaded payloads

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
injection_typeNoerror_based
database_typeNogeneric
nameNocustom

Implementation Reference

  • The handler function for the 'load_custom_payloads_from_file' MCP tool. Decorated with @mcp.tool(), it loads custom SQL injection payloads from a file by delegating to 'load_custom_payloads' helper, caches them, and returns success/error info.
    @mcp.tool()
    def load_custom_payloads_from_file(
        file_path: str,
        injection_type: str = "error_based",
        database_type: str = "generic",
        name: str = "custom"
    ) -> dict:
        """
        Load custom SQL injection payloads from a file.
        
        Args:
            file_path: Absolute path to the payload file (one payload per line)
            injection_type: Injection type for loaded payloads
            database_type: Database type for loaded payloads
            name: Name to cache the payloads under for later use
        
        Returns:
            Information about loaded payloads
        """
        try:
            payloads = load_custom_payloads(
                file_path,
                InjectionType(injection_type),
                DatabaseType(database_type)
            )
            custom_payloads_cache[name] = payloads
            
            return {
                "success": True,
                "name": name,
                "count": len(payloads),
                "preview": [p.value for p in payloads[:5]],
                "message": f"Loaded {len(payloads)} custom payloads from {file_path}"
            }
        except FileNotFoundError:
            return {
                "success": False,
                "error": f"File not found: {file_path}"
            }
        except Exception as e:
            return {
                "success": False,
                "error": str(e)
            }
  • The function signature defines the input schema for the tool: file_path (str), injection_type (str, default 'error_based'), database_type (str, default 'generic'), and name (str, default 'custom'). The return type is dict.
    def load_custom_payloads_from_file(
        file_path: str,
        injection_type: str = "error_based",
        database_type: str = "generic",
        name: str = "custom"
    ) -> dict:
  • The tool is registered using the @mcp.tool() decorator on the function, which registers it with the FastMCP server instance.
    @mcp.tool()
  • The 'load_custom_payloads' helper function reads payloads from a file (one per line, skipping comments) and returns a list of Payload objects. This is the core logic called by the tool handler.
    def load_custom_payloads(
        file_path: str,
        injection_type: InjectionType = InjectionType.ERROR_BASED,
        database_type: DatabaseType = DatabaseType.GENERIC
    ) -> list[Payload]:
        """
        Load custom payloads from a file (one payload per line).
        
        Args:
            file_path: Path to the file containing payloads
            injection_type: Default injection type for loaded payloads
            database_type: Default database type for loaded payloads
        
        Returns:
            List of Payload objects
        """
        path = Path(file_path)
        if not path.exists():
            raise FileNotFoundError(f"Payload file not found: {file_path}")
        
        payloads = []
        with open(path, "r", encoding="utf-8") as f:
            for line_num, line in enumerate(f, 1):
                line = line.strip()
                if line and not line.startswith("#"):  # Skip empty lines and comments
                    payloads.append(Payload(
                        value=line,
                        injection_type=injection_type,
                        database_type=database_type,
                        description=f"Custom payload from {path.name}:{line_num}"
                    ))
        
        return payloads
Behavior3/5

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

The description discloses that payloads are cached under a given name, but does not detail side effects like file access requirements or error handling. With no annotations, transparency is moderate.

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 concise, structured with Args and Returns sections, and contains no unnecessary words. Every sentence adds value.

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?

The tool has no output schema, but the description only vaguely mentions 'Information about loaded payloads'. It does not cover error cases or return format, leaving completeness moderate.

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?

Despite 0% schema description coverage, the description adds meaning for all parameters: file_path (absolute path, one per line), injection_type, database_type, and name (for caching). This compensates well for the schema's lack of descriptions.

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 loads custom SQL injection payloads from a file. It uses a specific verb-resource combination, distinguishing it from siblings like list_payloads or test_payload.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. The description lacks explicit usage context, prerequisites, or exclusions.

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/vivashu27/SQLinjector_MCP'

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