Skip to main content
Glama

gitlab_list_project_members_by_project_name

Retrieve all contributors for a specific GitLab project using its name. This tool helps identify team members and their roles within a project.

Instructions

Lists all members (contributors) of a given GitLab project by project name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesThe name of the GitLab project.

Implementation Reference

  • The primary handler function implementing the tool logic. It fetches the list of projects, finds the one matching the given project name, and then retrieves its members using the helper method.
    async listProjectMembersByProjectName(projectName: string): Promise<any[]> { const projects = await this.listProjects(); const project = projects.find((p) => p.name === projectName); if (!project) { throw new Error(`Project with name ${projectName} not found.`); } return this.listProjectMembers(project.path_with_namespace); }
  • src/index.ts:199-212 (registration)
    Registers the tool in the MCP server's tool list, including name, description, and input schema definition.
    name: 'gitlab_list_project_members_by_project_name', description: 'Lists all members (contributors) of a given GitLab project by project name.', inputSchema: { type: 'object', properties: { projectName: { type: 'string', description: 'The name of the GitLab project.', }, }, required: ['projectName'], }, },
  • The MCP server request handler (dispatch) that extracts arguments and invokes the GitLabService handler method.
    case 'gitlab_list_project_members_by_project_name': { if (!gitlabService) { throw new Error('GitLab service is not initialized.'); } const { projectName } = args as { projectName: string }; const result = await gitlabService.listProjectMembersByProjectName(projectName); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Supporting helper method called by the main handler to fetch project members via GitLab API endpoint /members/all.
    async listProjectMembers(projectPath: string): Promise<any[]> { const encodedProjectPath = encodeURIComponent(projectPath); return this.callGitLabApi<any[]>( `projects/${encodedProjectPath}/members/all`, ); }
  • Supporting helper method to list all accessible projects with caching, used to find the project by name.
    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; }

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