Skip to main content
Glama

get_project

Retrieve detailed information about a GitLab project by specifying its ID or path, enabling users to access project data for management and integration purposes.

Instructions

取得 GitLab 專案詳細資訊

Args: project_id: 專案 ID(數字)或路徑(如 group/project)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • MCP tool registration and handler implementation for 'get_project'. It takes project_id as input and returns a string formatted with project details.
    @mcp.tool()
    def get_project(project_id: int | str) -> str:
        """取得 GitLab 專案詳細資訊
    
        Args:
            project_id: 專案 ID(數字)或路徑(如 group/project)
        """
        try:
            client = get_client()
            p = client.get_project(project_id)
            return f"""專案: {p['name']} [{p['id']}]
    路徑: {p['path_with_namespace']}
    描述: {p.get('description') or '無'}
    預設分支: {p.get('default_branch', 'N/A')}
    可見性: {p.get('visibility', 'N/A')}
    建立時間: {p.get('created_at', 'N/A')}
    最後活動: {p.get('last_activity_at', 'N/A')}
    星標數: {p.get('star_count', 0)} | Fork 數: {p.get('forks_count', 0)}
    網址: {p.get('web_url', '')}"""
        except GitLabAPIError as e:
  • Actual GitLab API interaction logic for 'get_project' in the GitLabClient class. It resolves the project ID and fetches the project JSON data.
    def get_project(self, project_id: int | str) -> dict:
        """GET /projects/:id"""
        pid = self._resolve_project_id(project_id)
        return self._get_json(f"/projects/{pid}")

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

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