Skip to main content
Glama
tuliperis

SharkMCP

by tuliperis

manage_config

Save, load, list, or delete reusable network packet capture and analysis configurations for Wireshark/tshark integration.

Instructions

Save, load, list, or delete reusable filter configurations. Allows LLMs to store commonly used capture and analysis parameters for easy reuse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform: save, load, list (brief), view (detailed), or delete a configuration
nameNoName of the configuration (required for save, load, delete)
detailedNoShow detailed configuration info when listing (only used with list action)
configNoConfiguration object (required for save action)

Implementation Reference

  • Main handler function executing the manage_config tool logic for CRUD operations on filter configurations.
    export async function manageConfigHandler(args: any) {
      try {
        const { action, name, config, detailed } = args;
    
        switch (action) {
          case 'save':
            if (!name || !config) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Both name and config are required for save action.',
                }],
                isError: true
              };
            }
    
            const filterConfig: FilterConfig = {
              name,
              ...config
            };
    
            await saveFilterConfig(filterConfig);
            return {
              content: [{
                type: 'text' as const,
                text: `Configuration '${name}' saved successfully!\n\nSaved config:\n${JSON.stringify(filterConfig, null, 2)}`,
              }],
            };
    
          case 'load':
            if (!name) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Name is required for load action.',
                }],
                isError: true
              };
            }
    
            const loadedConfig = await loadFilterConfig(name);
            if (!loadedConfig) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Configuration '${name}' not found.`,
                }],
                isError: true
              };
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `Configuration '${name}' loaded:\n\n${JSON.stringify(loadedConfig, null, 2)}`,
              }],
            };
    
          case 'list':
            const allConfigs = await listFilterConfigs();
            if (allConfigs.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'No saved configurations found.',
                }],
              };
            }
    
            if (detailed) {
              // Show detailed information for all configurations
              const detailedList = allConfigs.map(cfg => {
                const configDetails = [
                  `Name: ${cfg.name}`,
                  ...(cfg.description ? [`Description: ${cfg.description}`] : []),
                  ...(cfg.captureFilter ? [`Capture Filter: ${cfg.captureFilter}`] : []),
                  ...(cfg.displayFilter ? [`Display Filter: ${cfg.displayFilter}`] : []),
                  ...(cfg.outputFormat ? [`Output Format: ${cfg.outputFormat}`] : []),
                  ...(cfg.customFields ? [`Custom Fields: ${cfg.customFields}`] : []),
                  ...(cfg.interface ? [`Interface: ${cfg.interface}`] : []),
                  ...(cfg.timeout ? [`Timeout: ${cfg.timeout}s`] : []),
                  ...(cfg.maxPackets ? [`Max Packets: ${cfg.maxPackets}`] : [])
                ];
                return configDetails.join('\n  ');
              }).join('\n\n' + '─'.repeat(50) + '\n\n');
    
              return {
                content: [{
                  type: 'text' as const,
                  text: `Available configurations (${allConfigs.length}) - Detailed View:\n\n${'─'.repeat(50)}\n\n${detailedList}\n\n${'─'.repeat(50)}\n\nUse 'load' action with a specific name to get the full JSON configuration.`,
                }],
              };
            } else {
              // Show brief list (existing behavior)
              const configList = allConfigs.map(cfg => 
                `• ${cfg.name}${cfg.description ? `: ${cfg.description}` : ''}`
              ).join('\n');
    
              return {
                content: [{
                  type: 'text' as const,
                  text: `Available configurations (${allConfigs.length}):\n\n${configList}\n\nUse 'load' action to get full details of any configuration, or use 'view' action to see all configurations with full details.`,
                }],
              };
            }
    
          case 'view':
            const allConfigsForView = await listFilterConfigs();
            if (allConfigsForView.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'No saved configurations found.',
                }],
              };
            }
    
            const configDetails = allConfigsForView.map(cfg => 
              `${cfg.name}:\n${JSON.stringify(cfg, null, 2)}`
            ).join('\n\n' + '─'.repeat(60) + '\n\n');
    
            return {
              content: [{
                type: 'text' as const,
                text: `All configurations (${allConfigsForView.length}) - Full Details:\n\n${'─'.repeat(60)}\n\n${configDetails}\n\n${'─'.repeat(60)}`,
              }],
            };
    
          case 'delete':
            if (!name) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'Error: Name is required for delete action.',
                }],
                isError: true
              };
            }
    
            const deleted = await deleteFilterConfig(name);
            if (!deleted) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `Error: Configuration '${name}' not found.`,
                }],
                isError: true
              };
            }
    
            return {
              content: [{
                type: 'text' as const,
                text: `Configuration '${name}' deleted successfully.`,
              }],
            };
    
          default:
            return {
              content: [{
                type: 'text' as const,
                text: `Error: Unknown action '${action}'. Use save, load, list, view, or delete.`,
              }],
              isError: true
            };
        }
      } catch (error: any) {
        console.error(`Error managing config: ${error.message}`);
        return { 
          content: [{ type: 'text' as const, text: `Error: ${error.message}` }], 
          isError: true 
        };
      }
    } 
  • Input schema using Zod for validating manage_config tool parameters.
    export const manageConfigSchema = {
      action: z.enum(['save', 'load', 'list', 'view', 'delete']).describe('Action to perform: save, load, list (brief), view (detailed), or delete a configuration'),
      name: z.string().optional().describe('Name of the configuration (required for save, load, delete)'),
      detailed: z.boolean().optional().default(false).describe('Show detailed configuration info when listing (only used with list action)'),
      config: z.object({
        description: z.string().optional().describe('Description of what this config does'),
        captureFilter: z.string().optional().describe('BPF capture filter for packet capture'),
        displayFilter: z.string().optional().describe('Wireshark display filter for analysis'),
        outputFormat: z.enum(['json', 'fields', 'text']).optional().describe('Output format for analysis'),
        customFields: z.string().optional().describe('Custom field list for fields format'),
        timeout: z.number().optional().describe('Timeout in seconds for capture sessions'),
        maxPackets: z.number().optional().describe('Maximum packets to capture'),
        interface: z.string().optional().describe('Network interface to use')
      }).optional().describe('Configuration object (required for save action)')
    };
  • src/index.ts:48-53 (registration)
    Registration of the manage_config tool with the MCP server.
    server.tool(
      'manage_config',
      'Save, load, list, or delete reusable filter configurations. Allows LLMs to store commonly used capture and analysis parameters for easy reuse.',
      manageConfigSchema,
      async (args) => manageConfigHandler(args)
    );
  • Helper functions for config persistence: saveFilterConfig, loadFilterConfig, listFilterConfigs, deleteFilterConfig (also uses loadConfigFile and saveConfigFile from lines 89-109).
    export async function saveFilterConfig(filterConfig: FilterConfig): Promise<void> {
      const configFile = await loadConfigFile();
      configFile.configs[filterConfig.name] = filterConfig;
      await saveConfigFile(configFile);
    }
    
    /**
     * Load a filter configuration by name
     */
    export async function loadFilterConfig(name: string): Promise<FilterConfig | null> {
      const configFile = await loadConfigFile();
      return configFile.configs[name] || null;
    }
    
    /**
     * List all available filter configurations
     */
    export async function listFilterConfigs(): Promise<FilterConfig[]> {
      const configFile = await loadConfigFile();
      return Object.values(configFile.configs);
    }
    
    /**
     * Delete a filter configuration
     */
    export async function deleteFilterConfig(name: string): Promise<boolean> {
      const configFile = await loadConfigFile();
      if (configFile.configs[name]) {
        delete configFile.configs[name];
        await saveConfigFile(configFile);
        return true;
      }
      return false;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the four operations, it doesn't describe what happens during each action (e.g., whether 'delete' is permanent, whether 'save' overwrites existing configs, error conditions, or persistence mechanisms). For a CRUD-style tool with multiple operations, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is appropriately concise with two sentences that efficiently state the tool's purpose and value proposition. It's front-loaded with the core operations and avoids unnecessary elaboration. Every sentence contributes meaning without redundancy.

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

Completeness3/5

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

For a tool with 4 parameters (including a complex nested object), 100% schema coverage, and no output schema, the description provides adequate but minimal context. It covers the 'what' but lacks details about operational behavior, error handling, and integration with sibling tools. The absence of annotations increases the need for more comprehensive description.

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%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond what's in the schema - it mentions 'capture and analysis parameters' which aligns with the config object properties, but provides no additional semantic context about parameter relationships or usage patterns.

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

Purpose5/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 (save, load, list, delete) and resource (reusable filter configurations). It distinguishes from sibling tools by focusing on configuration management rather than packet capture or analysis operations, making the scope immediately apparent.

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 mentions 'allows LLMs to store commonly used capture and analysis parameters for easy reuse' which provides some context, but offers no explicit guidance on when to use this tool versus alternatives like manually configuring parameters each time. There's no mention of prerequisites, limitations, or comparison with sibling tools.

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

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/tuliperis/SharkMCP'

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