Skip to main content
Glama

search_exploits

Search the Metasploit database for exploits using keywords, CVE identifiers, or platform filters to identify vulnerabilities for authorized security testing.

Instructions

Search for exploits in Metasploit database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (e.g., 'windows smb', 'apache', 'CVE-2021-44228')
platformNoOptional: Filter by platform (windows, linux, etc.)

Implementation Reference

  • Handler for the 'search_exploits' tool. Parses input arguments (query and optional platform), constructs Metasploit 'search' command, executes it via msfconsole, and returns results or error in JSON format.
    case "search_exploits": {
      const { query, platform } = args as { query: string; platform?: string };
      const commands = platform 
        ? [`search platform:${platform} ${query}`]
        : [`search ${query}`];
    
      try {
        const results = await executeMsfCommand(commands);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  query,
                  platform: platform || null,
                  results,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: error.message,
              }),
            },
          ],
        };
      }
    }
  • src/index.ts:72-89 (registration)
    Registration of the 'search_exploits' tool in the MCP tools list, including name, description, and input schema definition.
    {
      name: "search_exploits",
      description: "Search for exploits in Metasploit database",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query (e.g., 'windows smb', 'apache', 'CVE-2021-44228')",
          },
          platform: {
            type: "string",
            description: "Optional: Filter by platform (windows, linux, etc.)",
          },
        },
        required: ["query"],
      },
    },
  • Input schema for the 'search_exploits' tool defining the expected parameters: required 'query' string and optional 'platform' string.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query (e.g., 'windows smb', 'apache', 'CVE-2021-44228')",
        },
        platform: {
          type: "string",
          description: "Optional: Filter by platform (windows, linux, etc.)",
        },
      },
      required: ["query"],
    },
  • Shared helper function used by search_exploits (and other tools) to execute arbitrary msfconsole commands asynchronously.
    async function executeMsfCommand(commands: string[]): Promise<string> {
      const commandString = commands.join("; ");
      const fullCommand = `msfconsole -q -x "${commandString}; exit"`;
      
      try {
        const { stdout, stderr } = await execAsync(fullCommand, {
          timeout: 60000, // 60 second timeout
          maxBuffer: 10 * 1024 * 1024, // 10MB buffer
        });
        return stdout || stderr;
      } catch (error: any) {
        throw new Error(error.message || "Command execution failed");
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but offers minimal information. It mentions searching a database but doesn't describe what constitutes an 'exploit' in this context, how results are returned (e.g., format, pagination), authentication requirements, or rate limits. This leaves significant gaps for a tool that likely returns security-sensitive data.

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 wasted words. It's appropriately sized for a simple search tool and front-loads the core purpose without unnecessary elaboration.

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 security tools and the absence of both annotations and an output schema, the description is insufficiently complete. It doesn't explain what an 'exploit' entails in this database, the format or scope of results, or any behavioral constraints. For a tool with potential security implications, this leaves too many unanswered questions.

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 thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain how 'query' interacts with 'platform' or provide search syntax examples). This meets the baseline for high schema coverage.

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 action ('Search for exploits') and target resource ('Metasploit database'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'search_auxiliary' or 'get_exploit_info', which prevents a perfect score.

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 'search_auxiliary' or 'get_exploit_info'. It lacks any context about prerequisites, typical use cases, or exclusions, offering only a basic functional statement.

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/andreransom58-coder/kali-metasploit-mcp'

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