Skip to main content
Glama

get_summary_stats

Analyze live network traffic on a specified interface to generate protocol hierarchy statistics, aiding in network diagnostics and LLM insights. Configure duration and interface for precise captures.

Instructions

Capture live traffic and provide protocol hierarchy statistics for LLM analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
durationNoCapture duration in seconds
interfaceNoNetwork interface to capture from (e.g., eth0, en0)en0

Implementation Reference

  • The main handler function implementing the get_summary_stats tool. Captures live network traffic using tshark for the specified duration and interface, then generates protocol hierarchy statistics (-qz io,phs) and returns them as text content.
    async (args) => {
      try {
        const tsharkPath = await findTshark();
        const { interface, duration } = args;
        const tempPcap = 'temp_capture.pcap';
        console.error(`Capturing summary stats on ${interface} for ${duration}s`);
    
        await execAsync(
          `${tsharkPath} -i ${interface} -w ${tempPcap} -a duration:${duration}`,
          { env: { ...process.env, PATH: `${process.env.PATH}:/usr/bin:/usr/local/bin:/opt/homebrew/bin` } }
        );
    
        const { stdout, stderr } = await execAsync(
          `${tsharkPath} -r "${tempPcap}" -qz io,phs`,
          { env: { ...process.env, PATH: `${process.env.PATH}:/usr/bin:/usr/local/bin:/opt/homebrew/bin` } }
        );
        if (stderr) console.error(`tshark stderr: ${stderr}`);
    
        await fs.unlink(tempPcap).catch(err => console.error(`Failed to delete ${tempPcap}: ${err.message}`));
    
        return {
          content: [{
            type: 'text',
            text: `Protocol hierarchy statistics for LLM analysis:\n${stdout}`,
          }],
        };
      } catch (error) {
        console.error(`Error in get_summary_stats: ${error.message}`);
        return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true };
      }
    }
  • Zod schema defining input parameters for get_summary_stats: optional interface (default 'en0') and duration (default 5 seconds).
    {
      interface: z.string().optional().default('en0').describe('Network interface to capture from (e.g., eth0, en0)'),
      duration: z.number().optional().default(5).describe('Capture duration in seconds'),
    },
  • index.js:100-138 (registration)
    The server.tool() call registering the get_summary_stats tool, including its name, description, input schema, and handler function reference.
    server.tool(
      'get_summary_stats',
      'Capture live traffic and provide protocol hierarchy statistics for LLM analysis',
      {
        interface: z.string().optional().default('en0').describe('Network interface to capture from (e.g., eth0, en0)'),
        duration: z.number().optional().default(5).describe('Capture duration in seconds'),
      },
      async (args) => {
        try {
          const tsharkPath = await findTshark();
          const { interface, duration } = args;
          const tempPcap = 'temp_capture.pcap';
          console.error(`Capturing summary stats on ${interface} for ${duration}s`);
    
          await execAsync(
            `${tsharkPath} -i ${interface} -w ${tempPcap} -a duration:${duration}`,
            { env: { ...process.env, PATH: `${process.env.PATH}:/usr/bin:/usr/local/bin:/opt/homebrew/bin` } }
          );
    
          const { stdout, stderr } = await execAsync(
            `${tsharkPath} -r "${tempPcap}" -qz io,phs`,
            { env: { ...process.env, PATH: `${process.env.PATH}:/usr/bin:/usr/local/bin:/opt/homebrew/bin` } }
          );
          if (stderr) console.error(`tshark stderr: ${stderr}`);
    
          await fs.unlink(tempPcap).catch(err => console.error(`Failed to delete ${tempPcap}: ${err.message}`));
    
          return {
            content: [{
              type: 'text',
              text: `Protocol hierarchy statistics for LLM analysis:\n${stdout}`,
            }],
          };
        } catch (error) {
          console.error(`Error in get_summary_stats: ${error.message}`);
          return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true };
        }
      }
    );
  • Helper function findTshark() used by the handler to dynamically locate the tshark executable, with platform-specific fallbacks.
    async function findTshark() {
      try {
        const tsharkPath = await which('tshark');
        console.error(`Found tshark at: ${tsharkPath}`);
        return tsharkPath;
      } catch (err) {
        console.error('which failed to find tshark:', err.message);
        const fallbacks = process.platform === 'win32'
          ? ['C:\\Program Files\\Wireshark\\tshark.exe', 'C:\\Program Files (x86)\\Wireshark\\tshark.exe']
          : ['/usr/bin/tshark', '/usr/local/bin/tshark', '/opt/homebrew/bin/tshark', '/Applications/Wireshark.app/Contents/MacOS/tshark'];
        
        for (const path of fallbacks) {
          try {
            await execAsync(`${path} -v`);
            console.error(`Found tshark at fallback: ${path}`);
            return path;
          } catch (e) {
            console.error(`Fallback ${path} failed: ${e.message}`);
          }
        }
        throw new Error('tshark not found. Please install Wireshark (https://www.wireshark.org/download.html) and ensure tshark is in your PATH.');
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool captures live traffic and provides statistics, implying a read-only operation, but doesn't mention potential side effects (e.g., network performance impact), permissions required, rate limits, or what happens if the interface is unavailable. For a tool that interacts with live network traffic, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core functionality ('capture live traffic and provide protocol hierarchy statistics') and includes the purpose ('for LLM analysis'). There is zero waste or redundancy, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of live network capture and analysis, the description is incomplete. No annotations exist to cover behavioral aspects, and there's no output schema to explain return values (e.g., statistics format). The description lacks details on error conditions, performance implications, or how results are formatted, leaving gaps for the agent to operate effectively in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('duration' and 'interface') well-documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as valid interface examples beyond 'en0' or typical duration ranges. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('capture live traffic' and 'provide protocol hierarchy statistics') and identifies the resource (network traffic). It distinguishes from siblings like 'analyze_pcap' (which likely analyzes existing files) and 'capture_packets' (which may capture without analysis), though it doesn't explicitly name these alternatives. The purpose is specific but could be more differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'capture_packets' or 'analyze_pcap'. It mentions 'for LLM analysis' which hints at a context, but doesn't specify prerequisites, exclusions, or comparative scenarios. Without explicit when/when-not instructions, the agent lacks clear usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/0xKoda/WireMCP'

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