Skip to main content
Glama

gitlab_list_projects_by_name

Find GitLab projects by name using fuzzy, case-insensitive search to quickly locate specific repositories within your GitLab instance.

Instructions

Filters GitLab projects by name using a fuzzy, case-insensitive match.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectNameYesThe name or partial name of the project to filter by.

Implementation Reference

  • The main handler function that implements the tool logic: fetches all accessible projects and filters them by the given projectName using case-insensitive partial matching on name or full namespace path.
    async filterProjectsByName(projectName: string): Promise<GitLabProject[]> { const allProjects = await this.listProjects(); const lowerCaseProjectName = projectName.toLowerCase(); return allProjects.filter( (project) => project.name.toLowerCase().includes(lowerCaseProjectName) || project.name_with_namespace .toLowerCase() .includes(lowerCaseProjectName), ); }
  • src/index.ts:1355-1369 (registration)
    Registration of the tool handler in the MCP server's CallToolRequest handler switch statement. Extracts projectName from args and calls the service method.
    case 'gitlab_list_projects_by_name': { if (!gitlabService) { throw new Error('GitLab service is not initialized.'); } const { projectName } = args as { projectName: string }; const result = await gitlabService.filterProjectsByName(projectName); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool definition including name, description, and input schema requiring 'projectName' string.
    name: 'gitlab_list_projects_by_name', description: 'Filters GitLab projects by name using a fuzzy, case-insensitive match.', inputSchema: { type: 'object', properties: { projectName: { type: 'string', description: 'The name or partial name of the project to filter by.', }, }, required: ['projectName'], },
  • Helper method that fetches and caches the list of all accessible GitLab projects (with membership and min access level 30), used by filterProjectsByName.
    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; }
  • Type definition for GitLabProject, used as return type for the handler and helper.
    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