Skip to main content
Glama

get_group_agents

Retrieve all agents assigned to a specified Wazuh group. Filter by group ID, set pagination, and control result limit.

Instructions

List agents belonging to a specific Wazuh group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesGroup name/identifier (e.g., 'default', 'linux-servers')
limitNoMaximum number of agents to return (1-100)
offsetNoPagination offset

Implementation Reference

  • The `get_group_agents` tool handler. Registers an MCP tool that accepts group_id (string), limit (number, default 25, max 100), and offset (number, default 0). Calls client.getGroupAgents() and returns a JSON response with agent details (id, name, ip, status, os_name, os_platform, version, last_keepalive), total count, limit, and offset. Includes error handling.
    server.tool(
      "get_group_agents",
      "List agents belonging to a specific Wazuh group",
      {
        group_id: z
          .string()
          .describe("Group name/identifier (e.g., 'default', 'linux-servers')"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(100)
          .default(25)
          .describe("Maximum number of agents to return (1-100)"),
        offset: z
          .number()
          .int()
          .min(0)
          .default(0)
          .describe("Pagination offset"),
      },
      async ({ group_id, limit, offset }) => {
        try {
          const response = await client.getGroupAgents(group_id, { limit, offset });
          const data = response.data;
    
          const result = {
            group_id,
            agents: data.affected_items.map((agent) => ({
              id: agent.id,
              name: agent.name,
              ip: agent.ip,
              status: agent.status,
              os_name: agent.os?.name,
              os_platform: agent.os?.platform,
              version: agent.version,
              last_keepalive: agent.lastKeepAlive,
            })),
            total: data.total_affected_items,
            limit,
            offset,
          };
    
          return {
            content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  error: error instanceof Error ? error.message : String(error),
                }),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Input schema for the get_group_agents tool using Zod validation: group_id (string), limit (integer, 1-100, default 25), offset (integer, min 0, default 0).
    {
      group_id: z
        .string()
        .describe("Group name/identifier (e.g., 'default', 'linux-servers')"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .default(25)
        .describe("Maximum number of agents to return (1-100)"),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .describe("Pagination offset"),
    },
  • src/index.ts:49-49 (registration)
    Registration call: registerGroupTools(server, client) is invoked in the main server setup, which registers the get_group_agents tool on the MCP server.
    registerGroupTools(server, client);
  • Client helper method getGroupAgents() that makes a GET request to /groups/{groupId}/agents on the Wazuh API, returning a paginated list of WazuhAgent objects.
    async getGroupAgents(
      groupId: string,
      params: Record<string, string | number> = {}
    ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhAgent>>> {
      return this.get(`/groups/${groupId}/agents`, params);
    }
Behavior2/5

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

With no annotations, the description carries the full burden. It only states the basic function and does not disclose behavioral traits like pagination, required existence of group_id, or any side effects. Minimal information.

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, concise sentence that front-loads the purpose. No unnecessary words.

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?

For a simple list tool with no output schema, the description is adequate but lacks details on return values, error conditions, or pagination behavior. It covers the core purpose but could be more complete.

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 coverage is 100% with all parameters documented, so the baseline is 3. The description does not add any additional meaning beyond the schema; it simply restates the purpose.

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 lists agents for a specific Wazuh group, with a specific verb ('List') and resource ('agents belonging to a specific Wazuh group'). It distinguishes from sibling 'list_agents' which likely lists all agents.

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 like 'list_agents' or 'get_agent'. There is no mention of context, exclusions, or prerequisites.

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/solomonneas/wazuh-mcp'

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