Skip to main content
Glama

pentest_application

Perform penetration testing on web applications to identify security vulnerabilities using configurable test types and depth levels for comprehensive security assessment.

Instructions

Performs penetration testing on deployed applications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoTesting depth
targetUrlYesApplication URL
testTypesNoTypes of tests to perform

Implementation Reference

  • Core handler implementing the pentest_application tool logic: orchestrates Docker-based scans using OWASP ZAP for web vulnerabilities, custom tests for SQL injection, XSS, and security headers.
    async scan(request: ScanRequest): Promise<ScanResult> {
      const scanId = this.generateScanId();
      const startTime = Date.now();
    
      // Validate URL boundaries
      const validation = await this.boundaryEnforcer.validateUrl(request.target);
      if (!validation.allowed) {
        throw new Error(`URL boundary violation: ${validation.reason}`);
      }
    
      console.error(`Starting pentest scan: ${scanId}`);
    
      const allFindings: Finding[] = [];
      const errors: string[] = [];
      let tokenUsage = 0;
    
      // Determine test types to run
      const testTypes = request.tools || this.getDefaultTests(request.profile);
      
      try {
        // Run OWASP ZAP scan
        if (testTypes.includes('zap') || testTypes.includes('web_scan')) {
          const zapResults = await this.runZAP(request.target, testTypes);
          allFindings.push(...zapResults.findings);
          tokenUsage += zapResults.tokenUsage;
        }
    
        // Run specific vulnerability tests
        if (testTypes.includes('sql_injection')) {
          const sqlResults = await this.testSQLInjection(request.target);
          allFindings.push(...sqlResults.findings);
          tokenUsage += sqlResults.tokenUsage;
        }
    
        if (testTypes.includes('xss')) {
          const xssResults = await this.testXSS(request.target);
          allFindings.push(...xssResults.findings);
          tokenUsage += xssResults.tokenUsage;
        }
    
        if (testTypes.includes('security_headers')) {
          const headerResults = await this.testSecurityHeaders(request.target);
          allFindings.push(...headerResults.findings);
          tokenUsage += headerResults.tokenUsage;
        }
    
      } catch (error) {
        const errorMsg = `Pentest failed: ${error instanceof Error ? error.message : 'Unknown error'}`;
        console.error(errorMsg);
        errors.push(errorMsg);
      }
    
      // Calculate summary
      const summary = this.calculateSummary(allFindings);
    
      const result: ScanResult = {
        scanId,
        status: errors.length === 0 ? 'success' : (allFindings.length > 0 ? 'partial' : 'failed'),
        summary,
        findings: allFindings,
        tokenUsage,
        scanTimeMs: Date.now() - startTime,
        errors: errors.length > 0 ? errors : undefined,
      };
    
      console.error(`Pentest scan completed: ${result.status}, ${allFindings.length} findings`);
      return result;
    }
  • MCP tool call handler for 'pentest_application' that validates input, prepares ScanRequest, and delegates execution to PentestScanner.
    private async handlePentest(args: any): Promise<ScanResult> {
      const { targetUrl, testTypes = [], depth = 'standard' } = args;
    
      // Validate target URL is within project
      const validation = await this.boundaryEnforcer.validateUrl(targetUrl);
      if (!validation.allowed) {
        throw new McpError(ErrorCode.InvalidRequest, validation.reason || 'URL validation failed');
      }
    
      // Perform pentest
      const request: ScanRequest = {
        type: 'application',
        target: targetUrl,
        profile: depth,
        tools: testTypes,
        options: {
          maxTokens: this.tokenManager.getRemainingTokens(),
          maxDuration: 30 * 60 * 1000, // 30 minutes
        },
      };
    
      return await this.pentestScanner.scan(request);
    }
  • Input schema definition for the pentest_application tool, including parameters targetUrl (required), testTypes, and depth.
    {
      name: 'pentest_application',
      description: 'Performs penetration testing on deployed applications',
      inputSchema: {
        type: 'object',
        properties: {
          targetUrl: { type: 'string', description: 'Application URL' },
          testTypes: {
            type: 'array',
            items: { type: 'string' },
            description: 'Types of tests to perform'
          },
          depth: {
            type: 'string',
            enum: ['quick', 'standard', 'thorough'],
            description: 'Testing depth'
          },
        },
        required: ['targetUrl'],
      },
    },
  • Dispatch registration in the CallToolRequestSchema handler switch statement for routing 'pentest_application' calls to the appropriate handler.
    case 'pentest_application':
      result = await this.handlePentest(args);
      break;
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 of behavioral disclosure. It states the action ('performs penetration testing') but doesn't describe critical traits like whether this is a read-only or destructive operation, permission requirements, rate limits, or what the output looks like. For a potentially invasive security tool, this is a significant gap.

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 with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

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

Given the complexity of penetration testing (a potentially invasive operation), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral risks, output format, or usage context, which are critical for an agent to invoke this tool safely and effectively.

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 (depth, targetUrl, testTypes) with descriptions and an enum for depth. The description adds no additional meaning beyond what the schema provides, such as explaining what 'quick' vs 'thorough' entails or typical test types. Baseline 3 is appropriate when the schema does the heavy lifting.

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?

The description clearly states the verb ('performs penetration testing') and resource ('on deployed applications'), making the purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'scan_network' or 'scan_project', which might also involve security testing but on different targets.

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?

The description provides no guidance on when to use this tool versus alternatives like 'scan_network' or 'check_compliance'. It lacks explicit when/when-not scenarios, prerequisites, or named alternatives, leaving the agent to infer usage context from the tool name alone.

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/NeoTecDigital/mcp_shamash'

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