Skip to main content
Glama
jakenuts

SolarWinds Logs MCP Server

by jakenuts

visualize_logs

Generate histogram visualizations of log events over time to identify patterns and trends in SolarWinds Observability data.

Instructions

Generate a histogram visualization of log events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
intervalNoTime interval for histogram bucketshour
startTimeNoUTC start time (ISO 8601 format), defaults to 24 hours ago
endTimeNoUTC end time (ISO 8601 format), defaults to current time
filterNoA search query string
groupNoFilter logs by a specific group name
entityIdNoFilter logs by a specific entity ID
pageSizeNoMaximum messages to analyze
use_utcNoUse UTC time instead of local time
formatNoOutput format: text for ASCII chart, json for Claude visualizationtext

Implementation Reference

  • The main execution logic for the visualize_logs tool: searches logs using provided parameters, generates histogram data, produces ASCII chart or JSON output.
    export async function visualizeLogs(
      apiClient: SolarWindsApiClient,
      args: Record<string, any>
    ): Promise<string> {
      try {
        // Get current date/time
        const now = new Date();
        const oneDayAgo = new Date(now);
        oneDayAgo.setDate(oneDayAgo.getDate() - 1);
        
        // Set up search parameters
        const searchParams: SolarWindsSearchParams = {
          filter: args.filter,
          entityId: args.entityId,
          group: args.group,
          pageSize: args.pageSize || 1000,
          direction: 'backward', // Always use backward for visualization to get oldest to newest
          // Histograms always need a time range to be meaningful
          startTime: args.startTime !== undefined ? args.startTime : oneDayAgo.toISOString(),
          endTime: args.endTime !== undefined ? args.endTime : now.toISOString()
        };
    
        // Set up histogram options
        const histogramOptions: HistogramOptions = {
          interval: (args.interval as 'minute' | 'hour' | 'day') || 'hour',
          useUtc: args.use_utc || false,
        };
    
        // Perform the search
        const response = await apiClient.searchEvents(searchParams);
    
        // Convert the logs to a format compatible with the histogram generator
        const events = response.logs.map(log => ({
          id: log.id,
          received_at: log.time,
          display_received_at: log.time,
          hostname: log.hostname,
          program: log.program,
          message: log.message,
          // Add other required fields with placeholder values
          generated_at: log.time,
          source_name: log.hostname,
          source_id: 0,
          source_ip: '',
          facility: '',
          severity: log.severity
        }));
    
        // Generate histogram data
        const histogramData = generateHistogram(events, histogramOptions);
    
        // Check if the user wants JSON output for Claude visualization
        if (args.format === 'json') {
          // Format the data for Claude visualization
          const timeRanges = histogramData.data.map(point => point.time);
          const counts = histogramData.data.map(point => point.count);
          
          const claudeVisualizationData = {
            timeRanges,
            counts,
            total: histogramData.total,
            queryParams: {
              query: searchParams.filter || '',
              startTime: searchParams.startTime,
              endTime: searchParams.endTime
            }
          };
          
          return JSON.stringify(claudeVisualizationData, null, 2);
        }
    
        // Generate ASCII chart for text output
        const chart = generateAsciiChart(histogramData);
    
        // Format the response
        let result = '';
    
        // Add search parameters
        result += 'Visualization Parameters:\n';
        if (searchParams.filter) result += `Query: ${searchParams.filter}\n`;
        if (searchParams.entityId) result += `Entity ID: ${searchParams.entityId}\n`;
        if (searchParams.group) result += `Group: ${searchParams.group}\n`;
        result += `Start Time: ${searchParams.startTime}\n`;
        result += `End Time: ${searchParams.endTime}\n`;
        result += `Interval: ${histogramOptions.interval}\n`;
        result += `Timezone: ${histogramOptions.useUtc ? 'UTC' : 'Local'}\n`;
        result += `Page Size: ${searchParams.pageSize}\n`;
        result += '\n';
    
        // Add search metadata
        result += `Analyzed ${response.logs.length} logs\n`;
        if (response.pageInfo.nextPage) result += 'Note: More logs available. Results may be incomplete.\n';
        result += '\n';
    
        // Add chart
        result += chart;
    
        // Add note about JSON format
        result += '\n\nTip: Add "format": "json" to get data in a format that Claude can visualize as a chart.\n';
    
        return result;
      } catch (error) {
        throw error;
      }
    }
  • Zod schema defining input parameters for the visualize_logs tool, including interval, time range, filters, and output format.
    export const histogramOptionsSchema = {
      interval: z.enum(['minute', 'hour', 'day']).default('hour').describe('Time interval for histogram buckets'),
      startTime: z.string().optional().describe('UTC start time (ISO 8601 format), defaults to 24 hours ago'),
      endTime: z.string().optional().describe('UTC end time (ISO 8601 format), defaults to current time'),
      filter: z.string().optional().describe('A search query string'),
      group: z.string().optional().describe('Filter logs by a specific group name'),
      entityId: z.string().optional().describe('Filter logs by a specific entity ID'),
      pageSize: z.number().optional().default(1000).describe('Maximum messages to analyze'),
      use_utc: z.boolean().optional().default(false).describe('Use UTC time instead of local time'),
      format: z.enum(['text', 'json']).optional().default('text').describe('Output format: text for ASCII chart, json for Claude visualization')
    } as const;
  • MCP tool registration for 'visualize_logs' using server.tool(), linking schema and handler with error handling.
    // Register visualize_logs tool
    server.tool(
      'visualize_logs',
      'Generate a histogram visualization of log events',
      histogramOptionsSchema,
      async (args) => {
        try {
          const result = await visualizeLogs(apiClient, args);
          return {
            content: [
              {
                type: 'text',
                text: result,
              },
            ],
          };
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error);
          return {
            content: [
              {
                type: 'text',
                text: `Error visualizing logs: ${message}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
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 generates a visualization but doesn't describe what happens during execution (e.g., whether it processes data in real-time, accesses a database, has rate limits, requires specific permissions, or returns an image or text). For a tool with 9 parameters and no annotation coverage, 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 directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every word earns its place, achieving optimal conciseness.

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 (9 parameters, no annotations, no output schema), the description is incomplete. It doesn't address behavioral aspects like execution details, return format (beyond implied visualization), or error handling. For a visualization tool with multiple filtering options, more context is needed to guide effective use.

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?

The description adds no parameter-specific information beyond what's already in the input schema, which has 100% description coverage. It doesn't explain how parameters like 'filter' or 'group' affect the histogram or provide context for their usage. With high schema coverage, the baseline is 3, as the schema does the heavy lifting without additional value from the description.

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: 'Generate a histogram visualization of log events.' It specifies the action (generate), resource (histogram visualization), and target (log events). However, it doesn't explicitly differentiate from its sibling tool 'search_logs' beyond the visualization aspect, which is why it doesn't reach a perfect score.

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 its sibling 'search_logs' or any alternatives. There's no mention of use cases, prerequisites, or exclusions. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.

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/jakenuts/mcp-solarwinds'

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