get_wazuh_version
Retrieve the current Wazuh manager version and API details to verify connectivity and ensure compatibility.
Instructions
Get the Wazuh manager version and API information
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/version.ts:1-44 (handler)The 'get_wazuh_version' tool handler. It calls client.getVersion(), formats the response (title, api_version, revision, license, hostname, timestamp) and returns it as JSON text.
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { WazuhClient } from "../client.js"; export function registerVersionTools( server: McpServer, client: WazuhClient ): void { server.tool( "get_wazuh_version", "Get the Wazuh manager version and API information", {}, async () => { try { const response = await client.getVersion(); const info = response.data; const result = { title: info.title, api_version: info.api_version, revision: info.revision, license: info.license_name, hostname: info.hostname, timestamp: info.timestamp, }; 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/index.ts:43-43 (registration)Registration call: registerVersionTools(server, client) wires the tool into the MCP server.
registerVersionTools(server, client); - src/types.ts:22-30 (schema)Type definition for WazuhVersionInfo, which defines the schema of the data returned by get_wazuh_version (title, api_version, revision, license_name, license_url, hostname, timestamp).
export interface WazuhVersionInfo { title: string; api_version: string; revision: number; license_name: string; license_url: string; hostname: string; timestamp: string; } - src/client.ts:282-284 (helper)WazuhClient.getVersion() helper method that calls the API root endpoint (GET /) to retrieve version information.
async getVersion(): Promise<WazuhApiResponse<WazuhVersionInfo>> { return this.get("/"); }