Skip to main content
Glama

gate_stats

Read-only

Retrieve gate enforcement statistics including blocked and warned counts with top gate insights to monitor access control patterns.

Instructions

Get gate enforcement statistics -- blocked count, warned count, top gates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The calculateStats function processes gate definitions (manual and auto-promoted) and computes statistics like block counts, warnings, top blocked gate, and estimated time saved.
    function calculateStats() {
      const autoGatesPath = getAutoGatesPath();
      const manualGates = loadGatesFile(MANUAL_GATES_PATH);
      const autoGates = loadGatesFile(autoGatesPath);
      const allGates = [...manualGates, ...autoGates];
    
      let autoPromotedData = { promotionLog: [] };
      if (fs.existsSync(autoGatesPath)) {
        try { autoPromotedData = JSON.parse(fs.readFileSync(autoGatesPath, 'utf-8')); } catch {}
      }
      const promotionLog = autoPromotedData.promotionLog || [];
    
      const blockGates = allGates.filter((g) => g.action === 'block');
      const warnGates = allGates.filter((g) => g.action === 'warn');
    
      // Count total blocks/warns from occurrences in auto-promoted gates
      const totalBlocked = autoGates
        .filter((g) => g.action === 'block')
        .reduce((sum, g) => sum + (g.occurrences || 0), 0);
      const totalWarned = autoGates
        .filter((g) => g.action === 'warn')
        .reduce((sum, g) => sum + (g.occurrences || 0), 0);
    
      // Top blocked gate
      const topBlocked = [...allGates]
        .sort((a, b) => (b.occurrences || 0) - (a.occurrences || 0))
        .find((g) => g.action === 'block') || null;
    
      // Last promotion event
      const lastPromotion = promotionLog.length > 0
        ? promotionLog[promotionLog.length - 1]
        : null;
    
      // Time saved estimate: ~15 min per blocked mistake
      const estimatedMinutesSaved = (totalBlocked + totalWarned) * 15;
      const estimatedHoursSaved = (estimatedMinutesSaved / 60).toFixed(1);
    
      return {
        totalGates: allGates.length,
        manualGates: manualGates.length,
        autoPromotedGates: autoGates.length,
        blockGates: blockGates.length,
        warnGates: warnGates.length,
        totalBlocked,
        totalWarned,
        topBlocked,
        lastPromotion,
        estimatedHoursSaved,
        gates: allGates,
      };
    }
  • The MCP tool handler calls loadGateStats (from gates-engine) and returns the result as a text result for the "gate_stats" tool.
    case 'gate_stats':
      return toTextResult(loadGateStats());
  • CLI command "gate-stats" triggers the gate statistics reporting logic.
    case 'gate-stats':
      gateStats();
      break;
Behavior3/5

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

The annotations indicate readOnlyHint=true, which the description aligns with by using 'Get' (implying a read operation). The description adds context about what statistics are retrieved (blocked count, warned count, top gates), which is useful beyond the annotations. However, it does not disclose other behavioral traits like rate limits, authentication needs, or data freshness, which could be relevant for a stats tool.

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 front-loads the core purpose ('Get gate enforcement statistics') and lists the specific metrics without any wasted words. It is appropriately sized for a tool with no parameters and clear functionality.

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?

Given the tool's complexity is low (no parameters, read-only operation), the description covers the basic purpose and output metrics. However, there is no output schema, and the description does not explain the return format (e.g., structure of 'top gates'), which could be a gap. The annotations provide safety context, but more detail on output behavior would enhance completeness.

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?

The input schema has no parameters (parameter count: 0), and schema description coverage is 100%. The description does not add parameter information, which is unnecessary here. A baseline score of 4 is appropriate as the schema fully covers the lack of parameters, and the description does not need to compensate for any gaps.

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 with a specific verb ('Get') and resource ('gate enforcement statistics'), and it lists the specific metrics returned (blocked count, warned count, top gates). However, it does not explicitly differentiate this tool from potential siblings like 'feedback_stats' or 'get_business_metrics', which might also involve statistics, so it lacks sibling differentiation for a full 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 alternatives. It does not mention any context, prerequisites, or exclusions, such as whether it's for real-time monitoring, historical analysis, or specific user roles. With many sibling tools present, this omission leaves the agent without clear usage direction.

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/IgorGanapolsky/mcp-memory-gateway'

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