Skip to main content
Glama

getHostInfo

Retrieve configuration details for a specified SSH host using its alias or hostname, facilitating secure and informed interactions with remote systems.

Instructions

Returns all configuration details for an SSH host

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostAliasYesAlias or hostname of the SSH host

Implementation Reference

  • The handler function that implements the getHostInfo tool. It parses the SSH config and finds the host matching the given alias or hostname.
    async getHostInfo(hostAlias: string): Promise<SSHHostInfo | null> { const hosts = await this.configParser.parseConfig(); return hosts.find(host => host.alias === hostAlias || host.hostname === hostAlias) || null; }
  • Type definition for the SSHHostInfo interface, which is the return type of the getHostInfo tool.
    export interface SSHHostInfo { hostname: string; alias?: string; user?: string; port?: number; identityFile?: string; [key: string]: any; // For other configuration options }
  • The parseConfig method called by getHostInfo to load and parse the SSH configuration file into host information.
    async parseConfig(): Promise<SSHHostInfo[]> { try { const content = await readFile(this.configPath, 'utf-8'); const config = sshConfig.parse(content); return this.extractHostsFromConfig(config); } catch (error) { console.error('Error reading SSH config:', error); return []; } }

Other Tools

Related 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/AiondaDotCom/mcp-ssh'

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