Skip to main content
Glama

get_agent_processes

Lists all running processes on a specified Wazuh agent. Filter by process name or command to identify active software and detect potential threats.

Instructions

List running processes on a Wazuh agent

Input Schema

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

Implementation Reference

  • Registration of the get_agent_processes tool on the MCP server, including its name, description, schema (Zod), and handler function.
    server.tool(
      "get_agent_processes",
      "List running processes 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 processes to return (1-500)"),
        offset: z
          .number()
          .int()
          .min(0)
          .default(0)
          .describe("Pagination offset"),
        search: z
          .string()
          .optional()
          .describe("Filter processes by name or command"),
      },
      async ({ agent_id, limit, offset, search }) => {
        try {
          const params: Record<string, string | number> = { limit, offset };
          if (search) params.search = search;
    
          const response = await client.getAgentProcesses(agent_id, params);
          const data = response.data;
    
          const result = {
            agent_id,
            processes: data.affected_items.map((proc) => ({
              pid: proc.pid,
              name: proc.name,
              state: proc.state,
              ppid: proc.ppid,
              cmd: proc.cmd,
              argvs: proc.argvs,
              euser: proc.euser,
              vm_size: proc.vm_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,
          };
        }
      }
    );
  • Handler function for get_agent_processes: calls client.getAgentProcesses(), maps affected_items to a simplified process list, and returns formatted JSON response.
      async ({ agent_id, limit, offset, search }) => {
        try {
          const params: Record<string, string | number> = { limit, offset };
          if (search) params.search = search;
    
          const response = await client.getAgentProcesses(agent_id, params);
          const data = response.data;
    
          const result = {
            agent_id,
            processes: data.affected_items.map((proc) => ({
              pid: proc.pid,
              name: proc.name,
              state: proc.state,
              ppid: proc.ppid,
              cmd: proc.cmd,
              argvs: proc.argvs,
              euser: proc.euser,
              vm_size: proc.vm_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 for get_agent_processes: agent_id (string, required), limit (int 1-500, default 25), offset (int, default 0), and optional search (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 processes to return (1-500)"),
      offset: z
        .number()
        .int()
        .min(0)
        .default(0)
        .describe("Pagination offset"),
      search: z
        .string()
        .optional()
        .describe("Filter processes by name or command"),
    },
  • Client helper method getAgentProcesses that makes an HTTP GET request to /syscollector/{agentId}/processes on the Wazuh API.
    async getAgentProcesses(
      agentId: string,
      params: Record<string, string | number> = {}
    ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhProcess>>> {
      return this.get(`/syscollector/${agentId}/processes`, params);
    }
  • TypeScript interface WazuhProcess defining the full shape of a process object returned by the Wazuh API.
    export interface WazuhProcess {
      pid?: number;
      name?: string;
      state?: string;
      ppid?: number;
      utime?: number;
      stime?: number;
      cmd?: string;
      argvs?: string[];
      euser?: string;
      ruser?: string;
      suser?: string;
      egroup?: string;
      rgroup?: string;
      sgroup?: string;
      fgroup?: string;
      priority?: number;
      nice?: number;
      size?: number;
      vm_size?: number;
      resident?: number;
      share?: number;
      start_time?: number;
      pgrp?: number;
      session?: number;
      nlwp?: number;
      tgid?: number;
      tty?: number;
      processor?: number;
    }
Behavior2/5

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

No annotations exist, and the description only states 'List running processes'. It does not disclose any behavioral traits such as read-only nature, authentication needs, or error handling (e.g., invalid agent_id).

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, complete sentence that conveys the essential purpose without any unnecessary words. It is front-loaded and efficient.

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 minimal but combined with the input schema covers the basics. However, it lacks context about pagination, search, or expected output, which could be useful for a complete user understanding.

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%, so each parameter already has a description. The tool description does not add extra meaning beyond the schema, but it also does not detract.

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 explicitly states the verb 'List' and the resource 'running processes on a Wazuh agent'. It clearly distinguishes from sibling tools like get_agent_network or get_agent_os by specifying processes.

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?

No guidance is provided on when to use this tool versus alternatives, nor any prerequisites or conditions. The agent_id is required but not explained in context.

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