Skip to main content
Glama

Discover Active Agents

discover-agents

Find active AI agents in the MCP Agentic Framework to coordinate tasks and verify availability before messaging them.

Instructions

See who's awake in the conversation! Returns ALL active agents with their IDs, names, and current status. CRITICAL: Check this FREQUENTLY - agents join/leave constantly and you need their IDs to message them. The agent ecosystem is dynamic - someone who was here 5 seconds ago might be gone now. Always verify an agent exists before messaging them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
agentsYesList of currently registered agents

Implementation Reference

  • Main handler function for discover-agents tool. Calls agentRegistry.discoverAgents() to get all registered agents, creates resource links for agent profiles, formats the response with agent details (name, ID, status, description), and returns a structured response with metadata.
    /**
     * Discover all registered agents
     */
    export async function discoverAgents() {
      const startTime = Date.now();
      
      try {
        const agents = await agentRegistry.discoverAgents();
        
        // Create resource links for agent profiles
        const resourceLinks = agents.map(agent => 
          createAgentProfileLink(agent.id, agent.name)
        );
        
        const metadata = addResourceLinks(
          createMetadata(startTime, { 
            tool: 'discover-agents',
            agentCount: agents.length 
          }),
          resourceLinks
        );
        
        let message;
        if (agents.length === 0) {
          message = 'No agents currently registered';
        } else {
          // Include agent details in the message
          const agentList = agents.map(agent => 
            `- ${agent.name} (ID: ${agent.id})\n  Status: ${agent.status || 'No status set'}\n  Description: ${agent.description}`
          ).join('\n');
          message = `Found ${agents.length} registered agent${agents.length === 1 ? '' : 's'}:\n${agentList}`;
        }
        
        return structuredResponse({ agents }, message, metadata);
      } catch (error) {
        if (error instanceof MCPError) {
          throw error;
        }
        throw Errors.internalError(error.message);
      }
    }
  • Tool definition schema for discover-agents. Defines the tool name, title, description, inputSchema (empty properties object), and outputSchema with an agents array containing id, name, description, status, registeredAt, and lastActivityAt fields.
      name: 'discover-agents',
      title: 'Discover Active Agents',
      description: 'See who\'s awake in the conversation! Returns ALL active agents with their IDs, names, and current status. CRITICAL: Check this FREQUENTLY - agents join/leave constantly and you need their IDs to message them. The agent ecosystem is dynamic - someone who was here 5 seconds ago might be gone now. Always verify an agent exists before messaging them.',
      inputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {},
        additionalProperties: false
      },
      outputSchema: {
        $schema: 'http://json-schema.org/draft-07/schema#',
        type: 'object',
        properties: {
          agents: {
            type: 'array',
            description: 'List of currently registered agents',
            items: {
              type: 'object',
              properties: {
                id: { type: 'string' },
                name: { type: 'string' },
                description: { type: 'string' },
                status: { type: 'string' },
                registeredAt: { type: 'string' },
                lastActivityAt: { type: 'string' }
              }
            }
          }
        },
        required: ['agents'],
        additionalProperties: false
      }
    },
  • src/server.js:160-162 (registration)
    Registration of discover-agents tool in the MCP server's CallToolRequestSchema handler. Maps the 'discover-agents' tool name to the discoverAgents() handler function.
    case 'discover-agents': {
      return await discoverAgents();
    }
  • Core implementation of discoverAgents in the agent registry. Loads agents from JSON storage file and returns an array of agent objects with id, name, description, status, and lastActivityAt fields.
    const discoverAgents = async () => {
      const agents = await loadAgents(storagePath);
      
      return Object.values(agents).map(({ id, name, description, status, lastActivityAt }) => ({
        id,
        name,
        description,
        status,
        lastActivityAt
      }));
    };
Behavior4/5

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

No annotations are provided, so the description carries full burden. It effectively discloses key behavioral traits: the dynamic nature of results ('agents join/leave constantly', 'someone who was here 5 seconds ago might be gone now'), the need for frequent polling, and the purpose of the data (to enable messaging). However, it doesn't mention rate limits, authentication needs, or response format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured and front-loaded with the core purpose, followed by critical usage notes. Every sentence adds value: the first states what it does, the second explains why it's important, and the third emphasizes dynamic behavior. Slightly verbose with repetition of the dynamic aspect, but overall efficient.

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 has 0 parameters, 100% schema coverage, and an output schema exists, the description is complete. It thoroughly explains the tool's purpose, dynamic behavior, and critical usage guidelines without needing to detail parameters or return values, making it highly effective for agent understanding.

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?

There are 0 parameters, and schema description coverage is 100%, so the baseline is 4. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose and usage context, which adds value beyond the empty 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 the specific action ('Returns ALL active agents') and resource ('active agents with their IDs, names, and current status'), distinguishing it from siblings like 'register-agent', 'update-agent-status', or 'send-message'. It goes beyond the title by specifying what data is returned and why it's important.

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

Usage Guidelines5/5

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

Explicitly states when to use ('Check this FREQUENTLY - agents join/leave constantly') and why ('you need their IDs to message them'), with clear alternatives implied ('Always verify an agent exists before messaging them'). It provides strong context for usage frequency and prerequisites for other tools.

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/Piotr1215/mcp-agentic-framework'

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