Skip to main content
Glama

gitlab_get_current_project

Retrieve current GitLab project details by automatically detecting the repository from git remotes. No parameters needed when working in a git repository with GitLab remote.

Instructions

Auto-detect project from git repository Returns: Same as gitlab_get_project Use when: Working in a git repo with GitLab remote No parameters needed: Examines git remotes

How it works:

  1. Checks git remotes in current/specified directory

  2. Identifies GitLab URLs

  3. Fetches project details from API

Related tools:

  • gitlab_get_project: When you know the project ID

  • gitlab_list_projects: Browse available projects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoLocal git repository path Type: string Format: Absolute or relative file system path Default: '.' (current directory) Examples: - '.' (current directory) - '/home/user/projects/my-app' (absolute path) - '../other-project' (relative path) - '~/repos/gitlab-project' (home directory) Use case: Detect project from a different directory

Implementation Reference

  • The primary handler function for the 'gitlab_get_current_project' tool. It extracts an optional 'path' argument (defaults to current directory), calls the GitLabClient's get_current_project method to detect the project from git remotes, and returns the project details or an error if no GitLab project is found.
    def handle_get_current_project(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting current project using git detection"""
        path = get_argument(arguments, "path", ".")
        result = client.get_current_project(path)
    
        if not result:
            return {"error": ERROR_NO_PROJECT}
        return result
  • The MCP tool schema definition specifying the input parameters (optional 'path' string for git directory) and description for 'gitlab_get_current_project'.
    types.Tool(
        name=TOOL_GET_CURRENT_PROJECT,
        description=desc.DESC_GET_CURRENT_PROJECT,
        inputSchema={
            "type": "object",
            "properties": {
                "path": {"type": "string", "description": desc.DESC_GIT_PATH}
            }
        }
    ),
  • Registration of the handler function in the TOOL_HANDLERS dictionary mapping, used by the MCP server to dispatch tool calls to the correct implementation.
    TOOL_GET_CURRENT_PROJECT: handle_get_current_project,
  • Tool registration in the MCP server's list_tools() method, defining the tool schema and description exposed to clients.
        name=TOOL_GET_CURRENT_PROJECT,
        description=desc.DESC_GET_CURRENT_PROJECT,
        inputSchema={
            "type": "object", 
            "properties": {
                "path": {"type": "string", "description": desc.DESC_GIT_PATH}
            }
        }
    ),
  • Constant definition for the tool name string used consistently across the codebase for registration and references.
    TOOL_GET_CURRENT_PROJECT = "gitlab_get_current_project"
Behavior4/5

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

With no annotations provided, the description carries the full burden. It explains the multi-step process: checks git remotes, identifies GitLab URLs, fetches project details from API. It also states 'No parameters needed' (though there is an optional path parameter) and mentions what it returns. However, it doesn't disclose error handling, authentication requirements, or rate limits.

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 well-structured with clear sections (Returns, Use when, No parameters needed, How it works, Related tools), front-loads key information, and every sentence earns its place. It's appropriately sized for the tool's complexity without unnecessary verbosity.

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 moderate complexity (auto-detection logic), no annotations, and no output schema, the description does well by explaining the detection process, usage context, and return value reference. However, it could better address the optional path parameter discrepancy and provide more detail on error cases or authentication requirements.

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%, so the schema already fully documents the single optional 'path' parameter. The description adds minimal value beyond the schema: it mentions 'Examines git remotes' and 'No parameters needed' (contradicted by the schema's optional path), but doesn't provide additional semantic context about parameter usage or implications.

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

Purpose5/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: 'Auto-detect project from git repository' - a specific verb ('auto-detect') and resource ('project from git repository'). It distinguishes from siblings by explaining it examines git remotes automatically, unlike gitlab_get_project which requires a known project ID.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: 'Use when: Working in a git repo with GitLab remote' and lists two related tools with clear alternatives: gitlab_get_project for when you know the project ID, and gitlab_list_projects for browsing available projects. This gives clear when-to-use and when-not-to-use scenarios.

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

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