Skip to content

Commit 5af3f9f

Browse files
committed
fix: Move agent_list from body to query param for active-response API
Wazuh 4.x API expects agents_list as a query parameter on PUT /active-response, not as a field in the request body. Sending agent_list in the body caused 400 Bad Request with "Invalid field found {'agent_list'}".
1 parent 7a36d31 commit 5af3f9f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/wazuh_mcp_server/api/wazuh_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,12 @@ async def execute_active_response(self, data: Dict[str, Any]) -> Dict[str, Any]:
271271
# Ensure data dict doesn't contain deprecated 'custom' parameter
272272
if "custom" in data:
273273
data = {k: v for k, v in data.items() if k != "custom"}
274-
return await self._request("PUT", "/active-response", json=data)
274+
# Wazuh 4.x API: agent_list must be passed as query param 'agents_list', not in body
275+
agents_list = data.pop("agent_list", None)
276+
params = {}
277+
if agents_list:
278+
params["agents_list"] = ",".join(agents_list) if isinstance(agents_list, list) else str(agents_list)
279+
return await self._request("PUT", "/active-response", json=data, params=params)
275280

276281
async def get_active_response_commands(self, **params) -> Dict[str, Any]:
277282
"""Get available active response commands."""

0 commit comments

Comments
 (0)