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;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'fuzzy, case-insensitive match,' which adds some context beyond the input schema, but it does not cover critical aspects like pagination, rate limits, authentication requirements, error handling, or the format of returned results. For a tool with no annotations, this leaves significant behavioral gaps.

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 front-loads the key information: the action, resource, and filtering method. There is no wasted text, and it is appropriately sized for the tool's complexity.

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

Completeness3/5

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

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and filtering behavior but lacks details on usage guidelines, behavioral traits, and output format. Without annotations or an output schema, more context would be beneficial, but it meets the minimum for a simple tool.

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?

The input schema has 100% description coverage, with the parameter 'projectName' documented as 'The name or partial name of the project to filter by.' The description adds value by specifying 'fuzzy, case-insensitive match,' which clarifies the matching behavior beyond the schema. However, since schema coverage is high, the baseline is 3, and the description provides only marginal additional semantics.

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 tool's purpose: 'Filters GitLab projects by name using a fuzzy, case-insensitive match.' It specifies the action (filters), resource (GitLab projects), and key constraint (by name with fuzzy, case-insensitive matching). However, it does not explicitly differentiate from its sibling 'gitlab_list_all_projects', which is a notable gap in sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention the sibling 'gitlab_list_all_projects' or specify scenarios where fuzzy name filtering is preferred over listing all projects or other filtering methods. Usage is implied but not explicitly stated.

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

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