Skip to main content
Glama

verify

Check MCP server updates by replaying recorded cassettes against the live server and comparing responses to identify added tools, removed parameters, or altered response shapes.

Instructions

Use this after updating a server to confirm nothing broke. Connects to the live server, sends the same requests from a recorded cassette, and compares responses. Reports exactly what changed — added tools, removed parameters, different response shapes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cassetteYesPath to a cassette JSON file.
commandYesThe command to launch the MCP server.
argsNoAdditional arguments for the command.

Implementation Reference

  • The 'verify' MCP tool handler — registered as an MCP server tool. It loads a cassette, runs the server live, records responses, and compares them against the cassette using compareResponses().
    server.tool(
      "verify",
      "Use this after updating a server to confirm nothing broke. Connects to the live server, sends the same requests from a recorded cassette, and compares responses. Reports exactly what changed — added tools, removed parameters, different response shapes.",
      {
        cassette: z.string().describe("Path to a cassette JSON file."),
        command: z.string().describe("The command to launch the MCP server."),
        args: z.array(z.string()).optional().describe("Additional arguments for the command."),
      },
      async ({ cassette: cassettePath, command, args }) => {
        const startMs = Date.now();
        try {
          validateCommand(command);
          const cassettesDir = defaultCassettesDirectory();
          validatePath(cassettePath, cassettesDir);
          const cassette = await loadCassette(cassettePath);
          const target = {
            targetId: command,
            adapter: "local-process" as const,
            command,
            args: args ?? [],
            timeoutMs: 15_000,
          };
    
          const { cassetteEntries } = await runTargetRecording(target, { invokeTools: true });
          if (!cassetteEntries) {
            return { content: [{ type: "text" as const, text: "Failed to record live session for comparison." }], isError: true };
          }
    
          const result = compareResponses(cassette, cassetteEntries);
          const lines: string[] = [`Verify: ${result.passed} passed, ${result.failed} changed, ${result.missing} missing\n`];
          for (const entry of result.entries) {
            const icon = entry.status === "pass" ? "✓" : entry.status === "fail" ? "✗" : "?";
            lines.push(`  ${icon} ${entry.method}${entry.diff ? ` — ${entry.diff}` : ""}`);
          }
          logRequest("verify", startMs);
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        } catch (error) {
          const msg = errorMessage(error);
          logRequest("verify", startMs, true);
          return { content: [{ type: "text" as const, text: `Error verifying: ${msg}` }], isError: true };
        }
      },
    );
  • Type definitions for verify results — VerifyEntryResult (per-entry pass/fail/missing) and VerifyResult (aggregated stats).
    export interface VerifyEntryResult {
      method: string;
      status: "pass" | "fail" | "missing";
      expected?: unknown;
      actual?: unknown;
      diff?: string;
    }
    
    export interface VerifyResult {
      targetId: string;
      totalEntries: number;
      passed: number;
      failed: number;
      missing: number;
      entries: VerifyEntryResult[];
    }
  • compareResponses() — the core comparison logic that compares cassette response entries against live response entries and produces a VerifyResult.
    export function compareResponses(
      cassette: Cassette,
      liveEntries: CassetteEntry[],
    ): VerifyResult {
      const cassetteResponses = cassette.entries.filter((e) => e.direction === "response");
      const liveResponses = liveEntries.filter((e) => e.direction === "response");
    
      const entries: VerifyEntryResult[] = [];
    
      for (let i = 0; i < cassetteResponses.length; i++) {
        const expected = cassetteResponses[i]!;
        const actual = liveResponses[i];
    
        if (!actual) {
          entries.push({
            method: expected.method,
            status: "missing",
            expected: expected.result ?? expected.error,
          });
          continue;
        }
    
        if (expected.method !== actual.method) {
          entries.push({
            method: expected.method,
            status: "fail",
            expected: expected.result ?? expected.error,
            actual: actual.result ?? actual.error,
            diff: `Method mismatch: expected "${expected.method}", got "${actual.method}"`,
          });
          continue;
        }
    
        // Compare results structurally
        const expectedPayload = expected.error ? { error: expected.error } : { result: expected.result };
        const actualPayload = actual.error ? { error: actual.error } : { result: actual.result };
    
        if (deepEqual(expectedPayload, actualPayload)) {
          entries.push({ method: expected.method, status: "pass" });
        } else {
          entries.push({
            method: expected.method,
            status: "fail",
            expected: expectedPayload,
            actual: actualPayload,
            diff: summarizeDiff(expectedPayload, actualPayload),
          });
        }
      }
    
      // Check for extra live responses not in cassette
      for (let i = cassetteResponses.length; i < liveResponses.length; i++) {
        const actual = liveResponses[i]!;
        entries.push({
          method: actual.method,
          status: "fail",
          actual: actual.result ?? actual.error,
          diff: "Extra response not in cassette",
        });
      }
    
      return {
        targetId: cassette.targetId,
        totalEntries: entries.length,
        passed: entries.filter((e) => e.status === "pass").length,
        failed: entries.filter((e) => e.status === "fail").length,
        missing: entries.filter((e) => e.status === "missing").length,
        entries,
      };
    }
  • Helper functions deepEqual() and summarizeDiff() used by compareResponses for structural comparison and diff formatting.
    function deepEqual(a: unknown, b: unknown): boolean {
      if (a === b) return true;
      if (a === null || b === null) return false;
      if (typeof a !== typeof b) return false;
    
      if (Array.isArray(a)) {
        if (!Array.isArray(b) || a.length !== b.length) return false;
        return a.every((val, i) => deepEqual(val, b[i]));
      }
    
      if (typeof a === "object") {
        const aObj = a as Record<string, unknown>;
        const bObj = b as Record<string, unknown>;
        const aKeys = Object.keys(aObj).sort();
        const bKeys = Object.keys(bObj).sort();
        if (aKeys.length !== bKeys.length) return false;
        return aKeys.every((key, i) => key === bKeys[i] && deepEqual(aObj[key], bObj[key]));
      }
    
      return false;
    }
    
    function summarizeDiff(expected: unknown, actual: unknown): string {
      const expStr = JSON.stringify(expected, null, 2);
      const actStr = JSON.stringify(actual, null, 2);
    
      if (expStr.length > 200 || actStr.length > 200) {
        return "Response content differs (too large to display inline)";
      }
      return `Expected: ${expStr}\nActual: ${actStr}`;
    }
  • src/server.ts:117-154 (registration)
    The MCP server instance where the 'verify' tool is registered via server.tool() along with all other tools.
    server.tool(
      "scan",
      "Use this to check if all your MCP servers are healthy. Auto-discovers servers from Claude config files, connects to each one, and verifies tools/prompts/resources respond correctly. Use with deep=true to also invoke tools and confirm they actually execute. Returns pass/fail status for every server.",
      {
        config: z.string().optional().describe("Path to a specific MCP config file. If omitted, scans default locations."),
        deep: z.boolean().optional().describe("Also invoke safe tools to verify they execute."),
        security: z.boolean().optional().describe("Run security analysis on tool schemas."),
      },
      async ({ config, deep, security }) => {
        const startMs = Date.now();
        const targets = await scanForTargets(config);
        if (targets.length === 0) {
          logRequest("scan", startMs);
          return { content: [{ type: "text" as const, text: "No MCP server configs found." }] };
        }
    
        const opts: RunOptions = {};
        if (deep) opts.invokeTools = true;
        if (security) opts.securityCheck = true;
    
        const lines: string[] = [`Discovered ${targets.length} server(s):\n`];
        for (const t of targets) {
          if (t.config.targetId === "mcp-observatory") continue;
    
          lines.push(`--- ${t.config.targetId} (from ${t.source}) ---`);
          try {
            const artifact = await runTarget(t.config, opts);
            lines.push(formatRun(artifact));
          } catch (error) {
            const msg = errorMessage(error);
            lines.push(`  Error: ${msg}`);
          }
          lines.push("");
        }
        logRequest("scan", startMs);
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      },
    );
Behavior4/5

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

With no annotations, the description carries full burden. It explains key behaviors: connects to live server, sends requests from a recorded cassette, compares responses, and reports changes. It lacks details on potential side effects (e.g., read-only nature) or prerequisites, but covers core actions well.

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 concise at two sentences, with no redundant information. Every sentence adds value, clearly stating purpose, method, and output.

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?

Given no output schema, the description partially explains the output ('reports exactly what changed'). However, it doesn't specify the format or structure of the report, which could be critical for programmatic use. Otherwise, context is sufficient for a verification tool.

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 baseline is 3. The description adds no new information beyond the schema parameter descriptions (e.g., 'path to cassette', 'command', 'args'). It does not enhance semantic understanding.

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: verifying a server after an update by comparing responses against a recorded cassette. It specifies the verb ('confirm nothing broke') and resource ('server'), and effectively distinguishes from sibling tools like 'record' and 'replay'.

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?

The description provides explicit context for when to use ('after updating a server'), which is helpful. However, it does not mention when not to use it or name alternative tools (e.g., 'replay' vs 'verify'), leaving some ambiguity.

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/KryptosAI/mcp-observatory'

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