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"

Tool Definition Quality

Score is being calculated. Check back soon.

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