Skip to main content
Glama

terros_get_current_user

Retrieve the authenticated user's profile from Terros to access account details and manage user information.

Instructions

Get the authenticated user's own profile from Terros.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool registration and handler for 'terros_get_current_user'. This is where the tool is registered with the MCP server and the async handler that executes when called, which returns the current user's profile via client.getCurrentUser().
    server.tool(
      "terros_get_current_user",
      "Get the authenticated user's own profile from Terros.",
      {},
      async () => {
        try {
          return { content: [{ type: "text", text: toJsonText(await client.getCurrentUser()) }] };
        } catch (error) {
          return { content: [{ type: "text", text: toErrorText(error) }], isError: true };
        }
      }
    );
  • The getCurrentUser method in TerrosApiClient that makes the actual API call. It sends a POST request to '/user/get' with an empty body to retrieve the authenticated user's profile.
    async getCurrentUser(): Promise<unknown> {
      return this.post("/user/get", {});
    }
  • The HTTP POST method that handles all API requests including the getCurrentUser call. It sets up the authorization header, makes the fetch request, and handles errors.
    private async post(path: string, body: unknown): Promise<unknown> {
      const url = `${this.baseUrl}${path}`;
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: `ApiKey ${this.apiKey}`,
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify(body),
      });
    
      const contentType = response.headers.get("content-type") ?? "";
      const isJson = contentType.includes("application/json");
      const payload = isJson ? await response.json() : await response.text();
    
      if (!response.ok) {
        const p = payload as Record<string, unknown> | undefined;
        const detail =
          (typeof p?.message === "string" ? p.message : undefined) ??
          (typeof payload === "string" ? payload : undefined) ??
          response.statusText;
        throw new Error(`Terros API ${response.status}: ${detail}`);
      }
    
      return payload;
    }
  • The TerrosUser interface that defines the structure of user data returned by the getCurrentUser API call, including id, email, firstName, lastName, and role fields.
    export interface TerrosUser {
      id: string;
      email?: string;
      firstName?: string;
      lastName?: string;
      role?: string;
      [key: string]: unknown;
    }
  • src/server.ts:24-24 (registration)
    Where registerUserTools is called to register all user-related tools including terros_get_current_user when creating the MCP server.
    registerUserTools(server, client);

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/terros-inc/mcp'

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