Skip to main content
Glama

db_hosts

Lists all hosts discovered in the current Metasploit workspace to provide visibility into target systems during penetration testing and security assessments.

Instructions

List all hosts in the current workspace

Input Schema

NameRequiredDescriptionDefault
workspaceNoOptional: workspace name to query

Input Schema (JSON Schema)

{ "properties": { "workspace": { "description": "Optional: workspace name to query", "type": "string" } }, "type": "object" }

Implementation Reference

  • Handler implementation for the 'db_hosts' tool. Extracts optional workspace from arguments, constructs msfconsole commands to switch workspace if specified and list hosts, executes them, and returns formatted JSON response or error.
    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, }), }, ], }; } }
  • src/index.ts:153-165 (registration)
    Registration of the 'db_hosts' tool in the tools array passed to ListToolsRequestHandler. Includes name, description, and input schema definition.
    { name: "db_hosts", description: "List all hosts in the current workspace", inputSchema: { type: "object", properties: { workspace: { type: "string", description: "Optional: workspace name to query", }, }, }, },
  • Input schema for the 'db_hosts' tool defining optional 'workspace' parameter.
    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