Skip to main content
Glama
RMITBLOG

Parallels RAS MCP Server

by RMITBLOG

ras_pub_get_desktops

Retrieve published desktop resources to review assignments, check desktop types, and verify user access for RDS, VDI, or AVD environments.

Instructions

List published desktop resources, including full desktops available to users via RDS, VDI, or AVD. Use this to review desktop assignments, check which desktop types are published, or verify user access.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for ras_pub_get_desktops tool - executes GET request to '/api/publishing/desktops' endpoint and returns desktop data as JSON, with error handling using sanitiseError helper.
    async () => {
      try {
        const data = await rasClient.get("/api/publishing/desktops");
        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 published desktops") }], isError: true };
      }
    }
  • Tool registration for ras_pub_get_desktops - registers the tool with its title, description, read-only annotations, empty input schema, and handler function.
    server.registerTool(
      "ras_pub_get_desktops",
      {
        title: "Published Desktops",
        description:
          "List published desktop resources, including full desktops available to " +
          "users via RDS, VDI, or AVD. Use this to review desktop assignments, " +
          "check which desktop types are published, or verify user access.",
        annotations: READ_ONLY_ANNOTATIONS,
        inputSchema: {},
      },
      async () => {
        try {
          const data = await rasClient.get("/api/publishing/desktops");
          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 published desktops") }], isError: true };
        }
      }
    );
  • Input schema definition - empty object indicating no input parameters are required for the ras_pub_get_desktops tool.
    inputSchema: {},
  • RasClient.get() helper method - handles authentication, HTTP GET requests, automatic retry on 401, and request timeouts. Used by the handler to fetch desktop data from the RAS API.
    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();
    }
  • sanitiseError() helper function - sanitizes error messages by removing auth tokens, passwords, and truncating long responses. Used by the handler for error handling.
    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}`;
    }

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/RMITBLOG/ParallelsRAS_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server