Skip to main content
Glama

get_agent_packages

List software packages installed on a Wazuh agent. Filter by package name and paginate results for detailed software inventory.

Instructions

List software packages installed on a Wazuh agent

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent identifier (e.g., '001')
limitNoMaximum number of packages to return (1-500)
offsetNoPagination offset
searchNoFilter packages by name

Implementation Reference

  • The handler function for the 'get_agent_packages' tool. Calls client.getAgentPackages(), processes the response, and returns formatted package data (name, version, architecture, description, format, vendor, install_time, size). Handles errors and returns them as error responses.
    server.tool(
      "get_agent_packages",
      "List software packages installed on a Wazuh agent",
      {
        agent_id: z
          .string()
          .describe("Agent identifier (e.g., '001')"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(500)
          .default(25)
          .describe("Maximum number of packages to return (1-500)"),
        offset: z
          .number()
          .int()
          .min(0)
          .default(0)
          .describe("Pagination offset"),
        search: z
          .string()
          .optional()
          .describe("Filter packages by name"),
      },
      async ({ agent_id, limit, offset, search }) => {
        try {
          const params: Record<string, string | number> = { limit, offset };
          if (search) params.search = search;
    
          const response = await client.getAgentPackages(agent_id, params);
          const data = response.data;
    
          const result = {
            agent_id,
            packages: data.affected_items.map((pkg) => ({
              name: pkg.name,
              version: pkg.version,
              architecture: pkg.architecture,
              description: pkg.description,
              format: pkg.format,
              vendor: pkg.vendor,
              install_time: pkg.install_time,
              size: pkg.size,
            })),
            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 (Zod validations) for the 'get_agent_packages' tool: agent_id (string), limit (int 1-500, default 25), offset (int min 0, default 0), search (optional string).
    {
      agent_id: z
        .string()
        .describe("Agent identifier (e.g., '001')"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(500)
        .default(25)
        .describe("Maximum number of packages to return (1-500)"),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .describe("Pagination offset"),
      search: z
        .string()
        .optional()
        .describe("Filter packages by name"),
    },
  • src/index.ts:9-12 (registration)
    Registration: The tool is registered via the registerSyscollectorTools function, called at line 45 in src/index.ts, which imports and invokes it to register all syscollector tools.
    import { registerDecoderTools } from "./tools/decoders.js";
    import { registerVersionTools } from "./tools/version.js";
    import { registerScaTools } from "./tools/sca.js";
    import { registerSyscollectorTools } from "./tools/syscollector.js";
  • Helper/client method: getAgentPackages() in the WazuhClient class. Makes an API GET request to /syscollector/{agentId}/packages with optional query params. Returns typed response with WazuhPackage data.
    async getAgentPackages(
      agentId: string,
      params: Record<string, string | number> = {}
    ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhPackage>>> {
      return this.get(`/syscollector/${agentId}/packages`, params);
    }
  • Type definition for WazuhPackage, used as the response shape for package data returned by the API.
    export interface WazuhPackage {
      name: string;
      version?: string;
      architecture?: string;
      description?: string;
      format?: string;
      vendor?: string;
      install_time?: string;
      location?: string;
      size?: number;
      priority?: string;
      source?: string;
      section?: string;
      multiarch?: string;
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It correctly indicates a read operation ('List'), but does not disclose any additional behavioral traits such as error handling or performance considerations. For a simple list operation, this is minimally adequate.

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, 8-word sentence that is front-loaded with the key action. It is concise and contains 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?

The description is adequate for a simple list tool with well-defined parameters. However, it does not mention the return format or behavior on errors, which would be helpful given the absence of an output schema. There is room for improvement.

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?

The input schema has 100% description coverage for all parameters. The tool description adds no additional meaning beyond what is already in the schema, so it does not improve parameter understanding beyond baseline.

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 verb 'List' and the resource 'software packages installed on a Wazuh agent'. It is specific and distinct from sibling tools like get_agent_processes or get_agent_ports, which list different resources.

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 does not provide explicit guidance on when to use this tool versus alternatives. However, the sibling tool names imply distinct purposes, so usage context is inferred but not explicitly stated.

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