Skip to main content
Glama

server_explain

Read-onlyIdempotent

Explains an audit check's purpose, importance, fix tier, and compliance references. No SSH required; supports fuzzy matching.

Instructions

Deep-dive into a single audit check. Returns what it does, why it matters, how to fix it, fix tier (SAFE/GUARDED/FORBIDDEN), and compliance references (CIS/PCI-DSS/HIPAA). No SSH connection required. Supports case-insensitive and fuzzy matching for check IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
checkIdYesAudit check ID to explain (e.g. SSH-PASSWORD-AUTH). Case-insensitive, fuzzy matching supported.

Implementation Reference

  • The handler function for the 'server_explain' tool. It calls findCheckById() to look up an audit check, and returns the result via mcpSuccess or an error via mcpError with fuzzy-matching suggestions.
    export async function serverExplainHandler(params: ServerExplainParams) {
      const result = findCheckById(params.checkId);
    
      if (!result.match) {
        return mcpError(
          `Unknown check ID: ${params.checkId}. ${formatSuggestions(result.suggestions)}`,
          "Use server_audit with listChecks action or kastell audit --list-checks to see all available check IDs.",
        );
      }
    
      return mcpSuccess({ ...result.match });
    }
  • Zod schema for the server_explain tool input: requires a single 'checkId' string field with description about case-insensitive and fuzzy matching.
    export const serverExplainSchema = z.object({
      checkId: z.string().describe("Audit check ID to explain (e.g. SSH-PASSWORD-AUTH). Case-insensitive, fuzzy matching supported."),
    });
  • Registration of the 'server_explain' tool on the MCP server, including description, inputSchema, annotations (readOnlyHint, idempotentHint), and the async handler that delegates to serverExplainHandler.
    server.registerTool("server_explain", {
      description:
        "Deep-dive into a single audit check. Returns what it does, why it matters, how to fix it, fix tier (SAFE/GUARDED/FORBIDDEN), and compliance references (CIS/PCI-DSS/HIPAA). No SSH connection required. Supports case-insensitive and fuzzy matching for check IDs.",
      inputSchema: serverExplainSchema,
      annotations: {
        title: "Explain Audit Check",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: false,
      },
    }, async (params) => {
      return serverExplainHandler(params);
    });
  • Import line that pulls in serverExplainSchema and serverExplainHandler from the tools module.
    import { serverExplainSchema, serverExplainHandler } from "./tools/serverExplain.js";
  • Core lookup logic: findCheckById() performs exact match, case-insensitive match, substring match, and Levenshtein fuzzy matching (distance ≤ 3) to find audit check definitions in the catalog.
    export function findCheckById(checkId: string): FindCheckResult {
      const catalog = getFullCheckCatalog();
    
      // 1. Exact match — O(n) scan on 457 items is fast enough
      const exact = catalog.find((c) => c.id === checkId);
      if (exact) return { match: exact, suggestions: [] };
    
      // 2. Case-insensitive match
      const upper = checkId.toUpperCase();
      const ci = catalog.find((c) => c.id.toUpperCase() === upper);
      if (ci) return { match: ci, suggestions: [] };
    
      // 3. Substring match — e.g. "ssh-password" finds "SSH-PASSWORD-AUTH"
      const subs = catalog.filter((c) => c.id.toUpperCase().includes(upper));
      if (subs.length === 1) return { match: subs[0], suggestions: [] };
      if (subs.length > 1) return { match: null, suggestions: subs.slice(0, 3).map((s) => s.id) };
    
      // 4. Levenshtein ≤ 3
      const scored = catalog
        .map((c) => ({ id: c.id, dist: levenshtein(upper, c.id.toUpperCase()) }))
        .filter((s) => s.dist <= 3)
        .sort((a, b) => a.dist - b.dist);
    
      return {
        match: null,
        suggestions: scored.slice(0, 3).map((s) => s.id),
      };
    }
Behavior4/5

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

Adds value beyond annotations by stating 'No SSH connection required' and detailing matching behavior. No contradictions with annotations.

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?

Two sentences, front-loaded with purpose, no wasted words.

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?

Covers purpose, return types, behavior, and safety. Lacks output format details but adequate for a lookup tool with no output schema.

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?

Schema already covers the parameter thoroughly with example and matching behavior. The description reinforces but does not add significant new info beyond schema.

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?

Clearly states 'Deep-dive into a single audit check' and lists specific outputs. Differentiates from siblings like server_audit (which likely lists checks) by focusing on one check.

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

Usage Guidelines4/5

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

Explicitly mentions no SSH required and case-insensitive fuzzy matching, which informs usage context. Does not explicitly mention when not to use or alternative tools, but sibling names provide enough context.

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