Skip to main content
Glama

metasploit_search

Search Metasploit modules by service or platform to identify relevant exploits for penetration testing and security assessments.

Instructions

Search for Metasploit modules based on detected services

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesService name or version
platformNoTarget platform

Implementation Reference

  • Main handler function that executes Metasploit search via msfconsole, parses output, and returns ScanResult.
    async metasploitSearch(service: string, platform?: string): Promise<ScanResult> {
      try {
        let command = `msfconsole -q -x "search ${service}`;
        
        if (platform) {
          command += ` platform:${platform}`;
        }
        
        command += '; exit"';
        
        console.error(`Executing: ${command}`);
        
        const { stdout, stderr } = await execAsync(command, { 
          timeout: 60000 // 1 min timeout
        });
        
        const modules = this.parseMetasploitSearch(stdout);
        
        return {
          target: service,
          timestamp: new Date().toISOString(),
          tool: 'metasploit_search',
          results: {
            modules,
            total_found: modules.length,
            search_query: service,
            platform_filter: platform
          },
          status: 'success'
        };
      } catch (error) {
        return {
          target: service,
          timestamp: new Date().toISOString(),
          tool: 'metasploit_search',
          results: {},
          status: 'error',
          error: error instanceof Error ? error.message : String(error)
        };
      }
    }
  • MCP tool schema defining input parameters: service (required), platform (optional).
      name: "metasploit_search",
      description: "Search for Metasploit modules based on detected services",
      inputSchema: {
        type: "object",
        properties: {
          service: { type: "string", description: "Service name or version" },
          platform: { type: "string", description: "Target platform" }
        },
        required: ["service"]
      }
    },
  • src/index.ts:528-530 (registration)
    Tool dispatch registration in the main switch statement that routes calls to the exploitTools.metasploitSearch method.
    case "metasploit_search":
      return respond(await this.exploitTools.metasploitSearch(args.service, args.platform));
  • Helper function to parse Metasploit console search output into structured MetasploitModule array.
    private parseMetasploitSearch(output: string): MetasploitModule[] {
      const modules: MetasploitModule[] = [];
      const lines = output.split('\n');
      
      for (const line of lines) {
        // Parse metasploit module output
        if (line.includes('exploit/') || line.includes('auxiliary/')) {
          const parts = line.trim().split(/\s+/);
          if (parts.length >= 3) {
            modules.push({
              name: parts[0],
              description: parts.slice(2).join(' '),
              platform: [], // Would need more detailed parsing
              targets: [],
              rank: parts[1] || 'Unknown',
              disclosed: '',
              references: []
            });
          }
        }
      }
      
      return modules;
    }
  • TypeScript interface defining the structure of Metasploit modules returned by the tool.
    export interface MetasploitModule {
      name: string;
      description: string;
      platform: string[];
      targets: string[];
      rank: string;
      disclosed: string;
      references: string[];
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It mentions 'search' but doesn't describe what the search returns (e.g., module names, details, or exploits), whether it's read-only or has side effects, or any constraints like rate limits or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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 that front-loads the core purpose without unnecessary words. Every part earns its place by specifying the action, resource, and basis for search, making it easy 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 no annotations, no output schema, and a search tool with potential complexity (e.g., returning exploit modules), the description is incomplete. It doesn't explain what the output looks like, how results are formatted, or any behavioral traits like pagination or error handling. This makes it inadequate for reliable agent use.

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 both parameters ('service' and 'platform') with descriptions. The description adds no additional meaning beyond implying that 'service' is detected, which is redundant with the schema. Baseline 3 is appropriate as the schema does the heavy lifting, but the description doesn't compensate with extra context.

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 'Search' and resource 'Metasploit modules', specifying the purpose as finding modules based on detected services. It distinguishes from siblings like 'exploit_attempt' or 'cve_discovery' by focusing on module search rather than exploitation or vulnerability discovery. However, it doesn't explicitly differentiate from all siblings (e.g., 'suggest_next_steps' might also involve Metasploit).

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 minimal guidance by implying usage when services are detected, but offers no explicit when-to-use rules, alternatives, or exclusions. For example, it doesn't specify whether to use this before 'exploit_attempt' or how it relates to 'tech_detection'. Without such context, the agent must infer usage from the purpose 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/adriyansyah-mf/mcp-pentest'

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