traceroute
Trace the path of data packets to a target host, identifying network hops and latency issues for troubleshooting network connectivity problems.
Instructions
Perform traceroute to a host
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | Yes | Target host |
Implementation Reference
- src/tools/network.ts:159-174 (handler)The traceroute tool handler function. It determines the platform, constructs the appropriate command (tracert on Windows, traceroute on others), executes it via child_process.exec, and returns the stdout as text content. Throws an error if execution fails.handler: async ({ host }: { host: string }) => { const platform = os.platform(); const cmd = platform === 'win32' ? `tracert ${host}` : `traceroute ${host}`; try { const { stdout } = await execAsync(cmd); return { content: [{ type: 'text', text: stdout }] }; } catch (error) { throw new Error(`Traceroute failed: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
- src/tools/network.ts:149-158 (schema)Input schema for the traceroute tool, defining a required 'host' string parameter.inputSchema: { type: 'object', properties: { host: { type: 'string', description: 'Target host' } }, required: ['host'] },
- src/index.ts:29-36 (registration)Registers the networkTools object (containing the traceroute tool) into the allTools object, which is used by the MCP server for listing and dispatching tool calls....systemTools, ...networkTools, ...geoTools, ...generatorTools, ...dateTimeTools, ...securityTools };
- src/index.ts:146-148 (registration)Specific condition in tool call handler to assign the networkRateLimiter to traceroute tool executions.request.params.name === 'ping_host' || request.params.name === 'traceroute') { rateLimiter = networkRateLimiter;