Skip to main content
Glama

db_hosts

List all hosts in a Metasploit workspace to manage penetration testing targets and organize network reconnaissance data.

Instructions

List all hosts in the current workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceNoOptional: workspace name to query

Implementation Reference

  • Handler for the 'db_hosts' tool: executes Metasploit 'hosts' command (optionally after switching workspace) via executeMsfCommand and returns formatted JSON response.
    case "db_hosts": {
      const { workspace } = args as { workspace?: string };
      const commands = workspace 
        ? [`workspace ${workspace}`, `hosts`]
        : [`hosts`];
    
      try {
        const hosts = await executeMsfCommand(commands);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  workspace: workspace || "default",
                  hosts,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: error.message,
              }),
            },
          ],
        };
      }
    }
  • Input schema for 'db_hosts' tool defining optional 'workspace' parameter.
    inputSchema: {
      type: "object",
      properties: {
        workspace: {
          type: "string",
          description: "Optional: workspace name to query",
        },
      },
    },
  • src/index.ts:153-165 (registration)
    Registration of the 'db_hosts' tool in the MCP tools array, including name, description, and input schema.
    {
      name: "db_hosts",
      description: "List all hosts in the current workspace",
      inputSchema: {
        type: "object",
        properties: {
          workspace: {
            type: "string",
            description: "Optional: workspace name to query",
          },
        },
      },
    },

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