Skip to main content
Glama

gitlab_list_all_projects

Retrieve all accessible GitLab projects to view available repositories and manage development workflows.

Instructions

Lists all accessible GitLab projects. (Try to use list_projects_by_name as it is more efficient)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'gitlab_list_all_projects' tool that checks if GitLab service is initialized, calls listProjects on the service, and returns the JSON-stringified result as text content.
    case 'gitlab_list_all_projects': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const result = await gitlabService.listProjects();
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
  • Core implementation of listing all accessible GitLab projects using the API endpoint with caching. Maps full project data to simplified GitLabProject objects.
    async listProjects(): Promise<GitLabProject[]> {
      if (
        this.projectCache &&
        Date.now() - this.projectCache.timestamp < this.CACHE_DURATION_MS
      ) {
        return this.projectCache.data;
      }
    
      const url = `projects?membership=true&min_access_level=30&order_by=last_activity_at&sort=desc&per_page=100`;
      const projects = await this.callGitLabApi<any[]>(url);
    
      const simplifiedProjects: GitLabProject[] = projects.map((project) => ({
        id: project.id,
        name: project.name,
        name_with_namespace: project.name_with_namespace,
        path_with_namespace: project.path_with_namespace,
        last_activity_at: project.last_activity_at,
        ssh_url_to_repo: project.ssh_url_to_repo,
        http_url_to_repo: project.http_url_to_repo,
        web_url: project.web_url,
        readme_url: project.readme_url,
        issue_branch_template: project.issue_branch_template,
        statistics: project.statistics,
        _links: project._links,
      }));
    
      this.projectCache = { data: simplifiedProjects, timestamp: Date.now() };
      return simplifiedProjects;
    }
  • src/index.ts:229-236 (registration)
    Registration of the 'gitlab_list_all_projects' tool in the allTools array, including name, description, and empty input schema (no parameters required).
      name: 'gitlab_list_all_projects',
      description:
        'Lists all accessible GitLab projects. (Try to use list_projects_by_name as it is more efficient)',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • TypeScript interface defining the structure of GitLabProject objects returned by the listProjects method.
    export interface GitLabProject {
      id: number;
      name: string;
      name_with_namespace: string;
      path_with_namespace: string;
      last_activity_at: string;
    }

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

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