Skip to main content
Glama

server_evidence

Collect forensic evidence packages from servers by gathering firewall rules, authentication logs, system logs, and network port data for security auditing and incident investigation.

Instructions

Collect forensic evidence package from a server. Gathers firewall rules, auth.log, listening ports, system logs, and optionally Docker info. Writes to ~/.kastell/evidence/{server}/{date}/. Returns manifest with SHA256 checksums per file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serverNoServer name or IP. Auto-selected if only one server exists.
nameNoLabel for the evidence directory (e.g. 'pre-incident').
linesNoNumber of log lines to collect per file (default: 500).
no_dockerNoSkip Docker data collection.
no_sysinfoNoSkip system information collection.
forceNoOverwrite existing evidence directory.

Implementation Reference

  • The main handler function `handleServerEvidence` which executes the forensic evidence collection logic by invoking `collectEvidence` core function and returning a formatted MCP response.
    export async function handleServerEvidence(params: {
      server?: string;
      name?: string;
      lines?: number;
      no_docker?: boolean;
      no_sysinfo?: boolean;
      force?: boolean;
    }): Promise<McpResponse> {
      try {
        const servers = getServers();
        if (servers.length === 0) {
          return mcpError("No servers found");
        }
    
        const server = resolveServerForMcp(params, servers);
        if (!server) {
          if (params.server) {
            return mcpError(
              `Server not found: ${params.server}`,
              `Available servers: ${servers.map((s) => s.name).join(", ")}`,
            );
          }
          return mcpError(
            "Multiple servers found. Specify which server to collect evidence from.",
            `Available: ${servers.map((s) => s.name).join(", ")}`,
          );
        }
    
        const platform = server.platform ?? server.mode ?? "bare";
    
        const result = await collectEvidence(server.name, server.ip, platform, {
          name: params.name,
          lines: params.lines ?? 500,
          noDocker: params.no_docker ?? false,
          noSysinfo: params.no_sysinfo ?? false,
          force: params.force ?? false,
          json: false,
          quiet: true,
        });
    
        if (!result.success || !result.data) {
          return mcpError(result.error ?? "Evidence collection failed");
        }
    
        const { evidenceDir, serverName, serverIp, totalFiles, skippedFiles, collectedAt, manifestPath } =
          result.data;
    
        return mcpSuccess({
          evidenceDir,
          serverName,
          serverIp,
          platform,
          collectedAt,
          totalFiles,
          skippedFiles,
          manifestPath,
        });
      } catch (error: unknown) {
        return mcpError(getErrorMessage(error));
      }
    }
  • The Zod schema definition `serverEvidenceSchema` defining the input parameters for the tool.
    export const serverEvidenceSchema = {
      server: z
        .string()
        .optional()
        .describe("Server name or IP. Auto-selected if only one server exists."),
      name: z
        .string()
        .optional()
        .describe("Label for the evidence directory (e.g. 'pre-incident')."),
      lines: z
        .number()
        .default(500)
        .describe("Number of log lines to collect per file (default: 500)."),
      no_docker: z
        .boolean()
        .default(false)
        .describe("Skip Docker data collection."),
      no_sysinfo: z
        .boolean()
        .default(false)
        .describe("Skip system information collection."),
      force: z
        .boolean()
        .default(false)
        .describe("Overwrite existing evidence directory."),
    };
  • Registration of the `server_evidence` tool in the MCP server instance, mapping the name, schema, and handler.
    server.registerTool("server_evidence", {
      description:
        "Collect forensic evidence package from a server. Gathers firewall rules, auth.log, listening ports, system logs, and optionally Docker info. Writes to ~/.kastell/evidence/{server}/{date}/. Returns manifest with SHA256 checksums per file.",
      inputSchema: serverEvidenceSchema,
      annotations: {
        title: "Evidence Collection",
        readOnlyHint: false,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: true,
      },
    }, async (params) => {
      return handleServerEvidence(params);
    });
Behavior4/5

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

Beyond annotations (readOnlyHint:false, idempotentHint:false), the description adds valuable behavioral context: it discloses the file system write location (~/.kastell/evidence/), explains the return format (manifest with SHA256 checksums for integrity), and implies idempotency issues through the 'force' parameter for overwriting existing directories.

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?

Three dense sentences with zero waste: sentence 1 establishes purpose, sentence 2 details collected artifacts, sentence 3 explains output destination and format. Information is front-loaded and every clause earns its place.

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

Completeness4/5

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

For a 6-parameter tool with annotations present but no output schema, the description adequately covers what is collected, where it is written, and what is returned. It could be improved by mentioning permission requirements or execution duration, but the safety profile and behavioral traits are well documented.

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

Parameters4/5

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

With 100% schema coverage, the baseline is 3, but the description adds semantic context linking parameters to workflow: 'optionally Docker info' clarifies 'no_docker', the directory path example contextualizes 'server' and 'name', and the mention of overwriting implies 'force' behavior.

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 uses a specific verb 'Collect' with clear resource 'forensic evidence package from a server', details exactly what artifacts are gathered (firewall rules, auth.log, etc.), and distinguishes from siblings like 'server_logs' or 'server_backup' by emphasizing forensic integrity (SHA256 checksums) and specific output directory structure.

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

Usage Guidelines3/5

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

While the 'forensic' context implies investigative use, the description lacks explicit guidance on when to choose this over 'server_logs', 'server_audit', or 'server_backup', and does not state prerequisites or exclusion criteria (e.g., when not to use).

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/kastelldev/kastell'

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