Skip to main content
Glama
vivashu27

SQL Injection MCP Server

by vivashu27

list_payloads

Retrieve a filtered list of SQL injection payloads by category (e.g., error-based, time-based) and database type, with configurable limit.

Instructions

List available SQL injection payloads.

Args: category: Filter by category (error_based, time_based, boolean_based, union_based, blind) database: Filter by database type (mysql, mssql, postgresql, oracle, sqlite, generic) limit: Maximum number of payloads to return

Returns: List of available payloads with descriptions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNo
databaseNo
limitNo

Implementation Reference

  • The `list_payloads` tool handler registered as an MCP tool via @mcp.tool(). It accepts optional `category`, `database`, and `limit` parameters. It filters payloads by injection type, database type, or returns all payloads, then returns them with descriptions and category mappings.
    @mcp.tool()
    def list_payloads(
        category: Optional[str] = None,
        database: Optional[str] = None,
        limit: int = 20
    ) -> dict:
        """
        List available SQL injection payloads.
        
        Args:
            category: Filter by category (error_based, time_based, boolean_based, union_based, blind)
            database: Filter by database type (mysql, mssql, postgresql, oracle, sqlite, generic)
            limit: Maximum number of payloads to return
        
        Returns:
            List of available payloads with descriptions
        """
        if category:
            inj_type = InjectionType(category)
            payloads = get_payloads_by_type(inj_type)
        elif database:
            db_type = DatabaseType(database)
            payloads = get_payloads_by_database(db_type)
        else:
            payloads = get_all_payloads()
        
        # Apply database filter if both category and database specified
        if category and database:
            db_type = DatabaseType(database)
            payloads = [p for p in payloads if p.database_type == db_type or p.database_type == DatabaseType.GENERIC]
        
        return {
            "total_count": len(payloads),
            "showing": min(limit, len(payloads)),
            "categories": PAYLOAD_CATEGORIES,
            "payloads": [
                {
                    "value": p.value,
                    "type": p.injection_type.value,
                    "database": p.database_type.value,
                    "description": p.description
                }
                for p in payloads[:limit]
            ]
        }
  • The `Payload` Pydantic model defines the schema for payload data: `value` (the SQL injection string), `injection_type` (InjectionType enum), `database_type` (DatabaseType enum), and `description` (optional). This is the data shape returned by list_payloads.
    class Payload(BaseModel):
        """SQL injection payload."""
        value: str = Field(..., description="The payload string")
        injection_type: InjectionType = Field(..., description="Type of injection")
        database_type: DatabaseType = Field(..., description="Target database type")
        description: Optional[str] = Field(default=None, description="Payload description")
  • The `get_all_payloads()` function aggregates all payloads from the five submodules (error_based, time_based, boolean_based, union_based, blind) into a single list. This is the main data source for `list_payloads`.
    def get_all_payloads() -> list[Payload]:
        """Get all built-in payloads."""
        return (
            ERROR_BASED_PAYLOADS +
            TIME_BASED_PAYLOADS +
            BOOLEAN_BASED_PAYLOADS +
            UNION_BASED_PAYLOADS +
            BLIND_PAYLOADS
        )
  • The `get_payloads_by_type()` helper filters payloads by injection type (e.g., error_based, time_based). Used by `list_payloads` when the `category` parameter is provided.
    def get_payloads_by_type(injection_type: InjectionType) -> list[Payload]:
        """Get payloads filtered by injection type."""
        return [p for p in get_all_payloads() if p.injection_type == injection_type]
  • The `get_payloads_by_database()` helper filters payloads by database type (e.g., mysql, mssql). Used by `list_payloads` when the `database` parameter is provided.
    def get_payloads_by_database(database_type: DatabaseType) -> list[Payload]:
        """Get payloads filtered by database type."""
        all_payloads = get_all_payloads()
        return [
            p for p in all_payloads 
            if p.database_type == database_type or p.database_type == DatabaseType.GENERIC
        ]
Behavior2/5

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

No annotations provided, so description is the sole source. It mentions return type but does not disclose side effects, auth requirements, or rate limits. The read-only nature is not explicitly stated.

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 concise and front-loaded with purpose. The docstring format is efficient, though it could be slightly more compact.

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?

Adequately describes the tool's function given sibling tools. However, it lacks explanation of how the returned payloads integrate with scanning tools (e.g., test_payload). No output schema, but the description of return value is sufficient.

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 coverage, the description adds meaningful information: enum values for category and database, and a default for limit. This compensates for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it lists SQL injection payloads with filtering options. However, it does not differentiate from sibling tools like get_waf_bypass_payloads, which could cause confusion.

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 explicit guidance on when to use this tool versus alternatives like get_waf_bypass_payloads or load_custom_payloads_from_file. The description implies filtering usage but lacks when-not-to-use context.

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