Skip to main content
Glama

list_agents

Discover available AI agents and check their current status for collaboration and task execution within the system.

Instructions

List all known agents and their availability on this system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the list_agents tool, which calls listAgents() and formats the response.
    async () => {
      const agents = listAgents();
    
      return {
        content: [
          {
            type: 'text' as const,
            text: JSON.stringify({
              agents,
              total: agents.length,
              available: agents.filter((a) => a.available).length,
            }),
          },
        ],
      };
    }
  • Registration of the list_agents tool with the McpServer.
    export function registerListAgents(server: McpServer): void {
      server.tool(
        'list_agents',
        'List all known agents and their availability on this system.',
        {},
        { readOnlyHint: true, destructiveHint: false },
        async () => {
          const agents = listAgents();
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify({
                  agents,
                  total: agents.length,
                  available: agents.filter((a) => a.available).length,
                }),
              },
            ],
          };
        }
      );
    }
  • The helper function that performs the logic to list and check availability of agents.
    export function listAgents(): AgentInfo[] {
      const profiles = loadConfig();
      const builtInNames = new Set(Object.keys(BUILT_IN_PROFILES));
    
      return Object.entries(profiles).map(([name, profile]) => {
        const source: 'auto' | 'config' = builtInNames.has(name) ? 'auto' : 'config';
        return {
          name,
          command: profile.command,
          source,
          available: isCommandAvailable(profile.command),
        };
      });
    }

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/mikusnuz/agent-link-mcp'

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