Skip to main content
Glama

pingHost

Check network connectivity by pinging a target host. Specify the host and number of ping requests to diagnose network availability and latency.

Instructions

Ping a host using system ping command

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of ping requests
hostYesTarget host to ping

Implementation Reference

  • Handler function for pingHost tool that pings the specified host using the system's ping command, adjusting for Windows (-n) or Unix (-c) platforms, and returns the stdout output.
    handler: async ({ host, count = 4 }: { host: string; count?: number }) => { const platform = os.platform(); const pingCmd = platform === 'win32' ? `ping -n ${count} ${host}` : `ping -c ${count} ${host}`; try { const { stdout } = await execAsync(pingCmd); return { content: [{ type: 'text', text: stdout }] }; } catch (error) { throw new Error(`Ping failed: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
  • Input schema defining the parameters for the pingHost tool: required 'host' string and optional 'count' number (default 4).
    inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'Target host to ping' }, count: { type: 'number', description: 'Number of ping requests', default: 4 } }, required: ['host'] },
  • src/index.ts:28-35 (registration)
    Registration of all tools including networkTools (which contains pingHost) into the allTools object used for tool lookup, listing, and execution dispatching.
    const allTools: ToolKit = { ...systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };

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/cyanheads/toolkit-mcp-server'

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