Skip to main content
Glama

db_services

List all services discovered during penetration testing to analyze network exposure and identify potential attack vectors for security assessments.

Instructions

List all services in the current workspace

Input Schema

NameRequiredDescriptionDefault
hostNoOptional: filter by host IP address

Input Schema (JSON Schema)

{ "properties": { "host": { "description": "Optional: filter by host IP address", "type": "string" } }, "type": "object" }

Implementation Reference

  • Handler for the 'db_services' tool. Extracts optional 'host' parameter, constructs msfconsole 'services' command (filtered by host if provided), executes it, and returns JSON-formatted results or error.
    case "db_services": { const { host } = args as { host?: string }; const commands = host ? [`services -R ${host}`] : [`services`]; try { const services = await executeMsfCommand(commands); return { content: [ { type: "text", text: JSON.stringify( { success: true, host: host || "all", services, }, null, 2 ), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: error.message, }), }, ], }; } }
  • src/index.ts:166-178 (registration)
    Registration of the 'db_services' tool in the tools array, including name, description, and input schema. This is returned by ListToolsRequestSchema handler.
    { name: "db_services", description: "List all services in the current workspace", inputSchema: { type: "object", properties: { host: { type: "string", description: "Optional: filter by host IP address", }, }, }, },
  • Input schema definition for 'db_services' tool, defining optional 'host' string parameter.
    inputSchema: { type: "object", properties: { host: { type: "string", description: "Optional: filter by host IP address", }, }, },
  • Shared helper function used by 'db_services' handler to execute 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"); } }

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