Skip to main content
Glama
ttpears

GitLab MCP Server

by ttpears

Current User

get_current_user
Read-onlyIdempotent

Retrieve details about the authenticated GitLab user, including profile information and account settings, using provided credentials or shared tokens.

Instructions

Get information about the current authenticated GitLab user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userCredentialsNoYour GitLab credentials (optional - uses shared token if not provided)

Implementation Reference

  • Tool registration and handler definition for get_current_user - validates credentials and calls the GitLab client method, returning the currentUser from the result
    const getCurrentUserTool: Tool = {
      name: 'get_current_user',
      title: 'Current User',
      description: 'Get information about the current authenticated GitLab user',
      requiresAuth: true,
      requiresWrite: false,
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
      },
      inputSchema: withUserAuth(z.object({}).strict()),
      handler: async (input, client, userConfig) => {
        const credentials = input.userCredentials ? validateUserConfig(input.userCredentials) : userConfig;
        const result = await client.getCurrentUser(credentials);
        return result.currentUser;
      },
  • GitLab GraphQL client method that executes a query to fetch current user information (id, username, name, avatarUrl, webUrl) and returns the raw query result
    async getCurrentUser(userConfig?: UserConfig): Promise<any> {
      const query = gql`
        query getCurrentUser {
          currentUser {
            id
            username
            name
            avatarUrl
            webUrl
          }
        }
      `;
      return this.query(query, undefined, userConfig);
    }
  • Helper function that wraps input schemas to include optional userCredentials field (gitlabUrl and accessToken) for authentication
    // Helper to add user credentials to input schemas
    const withUserAuth = (baseSchema: z.ZodObject<any>, required = false) => {
      if (required) {
        return baseSchema.extend({
          userCredentials: z.object({
            gitlabUrl: z.string().url().optional(),
            accessToken: z.string().min(1),
          }).nullable().describe('Your GitLab credentials (required for this operation)'),
        });
      } else {
        return baseSchema.extend({
          userCredentials: UserCredentialsSchema.describe('Your GitLab credentials (optional - uses shared token if not provided)'),
        });
      }
    };
  • src/tools.ts:1339-1349 (registration)
    Main tools export array that includes all tool categories including userAuthTools which contains get_current_user
    export const tools: Tool[] = [
      ...readOnlyTools,
      ...userAuthTools,
      ...writeTools,
      updateIssueTool,
      updateMergeRequestTool,
      resolvePathTool,
      getGroupProjectsTool,
      getTypeFieldsTool,
      ...searchTools,
    ];
  • src/tools.ts:1312-1315 (registration)
    Export of userAuthTools array that includes getCurrentUserTool and getProjectsTool - tools that require user authentication
    export const userAuthTools: Tool[] = [
      getCurrentUserTool,
      getProjectsTool,
    ];
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, so the agent knows this is a safe, repeatable read operation. The description adds minimal behavioral context beyond this, mentioning authentication but not detailing rate limits, error conditions, or response format. It doesn't contradict annotations, but adds limited value given the annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 optional parameter, no output schema) and comprehensive annotations, the description provides adequate context for basic usage. However, it could be more complete by mentioning what specific user information is returned or clarifying the authentication context more explicitly, especially since there's no output schema to document the response structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'userCredentials' well-documented in the schema as optional GitLab credentials. The description doesn't add any meaningful parameter semantics beyond what the schema provides, such as explaining authentication fallback behavior in more detail. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('information about the current authenticated GitLab user'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_user_issues' or 'search_users', which also retrieve user-related data but with different scopes or filters.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving the current user's information, but doesn't provide explicit guidance on when to use this tool versus alternatives like 'search_users' or 'get_user_issues'. No exclusions or prerequisites are mentioned, leaving usage context somewhat implied rather than clearly defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ttpears/gitlab-mcp'

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