Skip to main content
Glama

monitor_agents

Read-onlyIdempotent

Monitor the status and health of governed AI agents. Returns supervisor state, repair history, and failure counts for proactive issue detection.

Instructions

Monitor the status and health of all governed AI agents. Returns supervisor state, repair history, and failure counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'monitor_agents' tool. It registers the MCP tool with the server, collects supervised agent states from the governance engine, queries Phoenix lifecycle records and Cerebro signals from PostgreSQL for historical intelligence data, emits a telemetry event, and returns a JSON response with active supervised agents, historical run stats, and recent alerts.
    export function registerMonitorAgentsTool(server: McpServer, engine: GovernanceEngine): void {
      server.tool(
        'monitor_agents',
        'Monitor the status and health of all governed AI agents. Returns supervisor state, repair history, and failure counts.',
        {},
        { title: 'Monitor Agent Health', readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false },
        async () => {
          const states = engine.supervisor.getAllStates();
          const agentData = Array.from(states.entries()).map(([name, state]) => ({
            name,
            lastStatus: state.lastStatus,
            repairAttempts: state.repairAttempts,
            consecutiveFailures: state.consecutiveFailures,
            lastScore: state.lastScore?.composite,
          }));
    
          // Phoenix lifecycle data — recent agent runs from PostgreSQL
          const [recentRuns, phoenixStats, recentSignals] = await Promise.all([
            getRecentPhoenixRecords(10),
            getPhoenixStats(),
            getRecentCerebroSignals(10),
          ]);
    
          // Tool accountability tracking
          engine.telemetryService.emitToolCall('monitor_agents', `monitor-${Date.now().toString(36)}`, 'INFORMATIONAL', true);
    
          // Derive historical agent count from Phoenix workforce breakdown
          const historicalWorkforces = Object.keys(phoenixStats.workforceBreakdown || {});
          const hasHistory = phoenixStats.totalRecords > 0;
          const agentStatus = agentData.length > 0
            ? `${agentData.length} agent(s) currently supervised.`
            : hasHistory
              ? `No agents currently supervised. ${phoenixStats.totalRecords} historical governed runs recorded across ${historicalWorkforces.length} workforce type(s).`
              : 'No agents supervised and no historical runs recorded.';
    
          return {
            content: [{ type: 'text' as const, text: JSON.stringify({
              activeSupervisedAgents: agentData.length,
              totalHistoricalRuns: phoenixStats.totalRecords,
              agentStatus,
              agents: agentData,
              phoenixLifecycle: {
                totalRecordedRuns: phoenixStats.totalRecords,
                last24hRuns: phoenixStats.last24hRecords,
                successRate: phoenixStats.totalRecords > 0
                  ? `${Math.round((phoenixStats.successCount / phoenixStats.totalRecords) * 100)}%`
                  : 'N/A',
                avgTokenEfficiency: phoenixStats.avgTokenEfficiency,
                workforceBreakdown: phoenixStats.workforceBreakdown,
                recentRuns: recentRuns.map(r => ({
                  runId: r.runId,
                  caseId: r.caseId,
                  workforce: r.workforceType,
                  status: r.finalStatus,
                  lineageDepth: r.lineageDepth,
                  tokenEfficiency: r.tokenEfficiency,
                  completedAt: r.completedAt,
                })),
              },
              cerebroAlerts: {
                recentSignals: recentSignals.map(s => ({
                  signalId: s.signalId,
                  severity: s.severity,
                  type: s.signalType,
                  title: s.title,
                  confidence: s.confidence,
                  timestamp: s.timestamp,
                })),
              },
            }, null, 2) }],
          };
        }
      );
    }
  • Schema/interface definition for monitor_agents: no input parameters (empty object). Output is a text/plain JSON blob. Title is 'Monitor Agent Health' with readOnlyHint and idempotentHint set to true.
    server.tool(
      'monitor_agents',
      'Monitor the status and health of all governed AI agents. Returns supervisor state, repair history, and failure counts.',
      {},
  • Import of the registerMonitorAgentsTool function in the MCP server.
    import { registerMonitorAgentsTool } from './tools/monitor-agents.js';
  • Registration of monitor_agents in the TOOL_REGISTRY as 'tenant' tier, meaning it is only exposed to authenticated tenant sessions (professional+ tier), not to public/guest clients.
    { tier: 'tenant', register: registerMonitorAgentsTool, description: 'monitor_agents' },
  • Accountability profile for monitor_agents in the GOVERNED_TOOL_REGISTRY: classified as 'read', risk tier 'low', MAI default 'INFORMATIONAL', no human approval required, category 'operations'.
    { toolName: 'monitor_agents',      toolClass: 'read',     riskTier: 'low',      maiDefault: 'INFORMATIONAL',  requiresHumanApproval: false, category: 'operations' },
Behavior4/5

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

Annotations already mark it as read-only, non-destructive, and idempotent. The description adds behavioral context by specifying the tool returns supervisor state, repair history, and failure counts, and clarifies the scope is all governed AI agents. No contradictions.

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 sentence that conveys purpose and return data efficiently. It is front-loaded with the verb 'Monitor' and resource 'status and health of all governed AI agents.' No redundant or irrelevant information.

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

Completeness5/5

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

Given the tool's simplicity (0 parameters, no output schema), the description is complete: it specifies what it monitors, the scope, and what data it returns. Annotations cover safety. No gaps.

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 (0), so the description is not required to explain them. It adds value by describing the return payload, which compensates for the lack of an output 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?

The description clearly states it monitors status and health of all governed AI agents, listing specific return data (supervisor state, repair history, failure counts). The title 'Monitor Agent Health' reinforces the purpose. Among siblings like agent_citizenship_status or colony_health, this tool is clearly distinguishable as a general health check for all governed agents.

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?

The description implies usage for general monitoring of governed agents but provides no explicit guidance on when to use this tool versus alternatives like colony_health or srt_diagnose. It lacks exclusion criteria or a when-not-to-use note.

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/knowledgepa3/gia-mcp-server'

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