get_agent_hotfixes
Retrieve installed Windows hotfixes and patches for a given Wazuh agent to assess patch compliance and update status.
Instructions
List Windows hotfixes/patches installed on a Wazuh agent
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | Agent identifier (e.g., '001') | |
| limit | No | Maximum number of hotfixes to return (1-500) | |
| offset | No | Pagination offset |
Implementation Reference
- src/tools/syscollector.ts:294-345 (registration)Registration of the 'get_agent_hotfixes' tool on the MCP server with Zod schema for agent_id, limit, and offset parameters
server.tool( "get_agent_hotfixes", "List Windows hotfixes/patches 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 hotfixes to return (1-500)"), offset: z .number() .int() .min(0) .default(0) .describe("Pagination offset"), }, async ({ agent_id, limit, offset }) => { try { const response = await client.getAgentHotfixes(agent_id, { limit, offset }); const data = response.data; const result = { agent_id, hotfixes: data.affected_items.map((h) => h.hotfix), 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, }; } } ); - src/tools/syscollector.ts:315-345 (handler)Handler function that calls client.getAgentHotfixes() and maps the response to return hotfix data
async ({ agent_id, limit, offset }) => { try { const response = await client.getAgentHotfixes(agent_id, { limit, offset }); const data = response.data; const result = { agent_id, hotfixes: data.affected_items.map((h) => h.hotfix), 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, }; } } ); - src/tools/syscollector.ts:297-314 (schema)Zod schema defining input parameters: agent_id (string), limit (number, 1-500, default 25), offset (number, int, min 0, default 0)
{ agent_id: z .string() .describe("Agent identifier (e.g., '001')"), limit: z .number() .int() .min(1) .max(500) .default(25) .describe("Maximum number of hotfixes to return (1-500)"), offset: z .number() .int() .min(0) .default(0) .describe("Pagination offset"), }, - src/client.ts:337-342 (helper)Client helper method that calls the Wazuh API GET /syscollector/{agentId}/hotfixes endpoint
async getAgentHotfixes( agentId: string, params: Record<string, string | number> = {} ): Promise<WazuhApiResponse<WazuhPaginatedData<WazuhHotfix>>> { return this.get(`/syscollector/${agentId}/hotfixes`, params); } - src/types.ts:278-280 (helper)TypeScript interface WazuhHotfix with an optional hotfix string property
export interface WazuhHotfix { hotfix?: string; }