ras_farm_get_version
Retrieve the current API version and build number for Parallels RAS web services to verify compatibility and check available features.
Instructions
Get the RAS web service (REST API) version information. Returns the current API version and build number. Use this to verify the API version is compatible or check which features are available.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/farm-settings.ts:87-106 (handler)The complete registration and handler implementation for ras_farm_get_version. This includes the tool registration with its schema (title, description, annotations, inputSchema) and the async handler function that calls rasClient.get('/api/farm-settings/webservice/version') to retrieve version information, returning JSON formatted data or handling errors with sanitiseError().server.registerTool( "ras_farm_get_version", { title: "Web Service Version", description: "Get the RAS web service (REST API) version information. Returns the " + "current API version and build number. Use this to verify the API version " + "is compatible or check which features are available.", annotations: READ_ONLY_ANNOTATIONS, inputSchema: {}, }, async () => { try { const data = await rasClient.get("/api/farm-settings/webservice/version"); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: "text" as const, text: sanitiseError(err, "Failed to retrieve version info") }], isError: true }; } } );
- src/tools/farm-settings.ts:87-97 (registration)Tool registration block defining the schema for ras_farm_get_version, including title 'Web Service Version', description, read-only annotations, and empty inputSchema object.server.registerTool( "ras_farm_get_version", { title: "Web Service Version", description: "Get the RAS web service (REST API) version information. Returns the " + "current API version and build number. Use this to verify the API version " + "is compatible or check which features are available.", annotations: READ_ONLY_ANNOTATIONS, inputSchema: {}, },
- src/tools/farm-settings.ts:98-105 (handler)The async handler function that executes the tool logic: makes GET request to /api/farm-settings/webservice/version via rasClient, formats response as JSON string, and catches errors with sanitiseError().async () => { try { const data = await rasClient.get("/api/farm-settings/webservice/version"); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: "text" as const, text: sanitiseError(err, "Failed to retrieve version info") }], isError: true }; } }
- src/client.ts:128-166 (helper)The rasClient.get() method used by the handler to make authenticated GET requests to the RAS API, handling lazy authentication, automatic retry on 401, and request timeouts.async get(path: string): Promise<unknown> { // Ensure we have a valid session if (!this.authToken) { await this.login(); } const fetchOptions = { method: "GET" as const, headers: { ...this.headers, auth_token: this.authToken!, }, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), }; let response = await fetch(`${this.baseUrl}${path}`, fetchOptions); // Token may have expired — re-authenticate once and retry if (response.status === 401) { await this.login(); response = await fetch(`${this.baseUrl}${path}`, { ...fetchOptions, headers: { ...this.headers, auth_token: this.authToken!, }, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), }); } if (!response.ok) { const body = await response.text(); throw new Error( `RAS API error (HTTP ${response.status}) on ${path}: ${body.substring(0, 300)}` ); } return response.json(); }
- src/client.ts:43-54 (helper)The sanitiseError() helper function used to sanitize error messages by removing auth tokens/passwords and truncating long responses before returning error context.function sanitiseError(err: unknown, context: string): string { const raw = err instanceof Error ? err.message : String(err); // Remove anything that looks like a token or password value let sanitised = raw .replace(/auth_token[=:]\s*\S+/gi, "auth_token=[REDACTED]") .replace(/password[=:]\s*\S+/gi, "password=[REDACTED]"); // Truncate excessively long API response bodies if (sanitised.length > 500) { sanitised = sanitised.substring(0, 500) + "... (truncated)"; } return `${context}: ${sanitised}`; }