Skip to main content
Glama

list_projects

Retrieve accessible GitLab projects with search filters and pagination controls to manage project visibility.

Instructions

列出可存取的 GitLab 專案

Args: search: 搜尋關鍵字(專案名稱) membership: 僅列出已加入的專案(預設 True) page: 頁碼(預設 1) per_page: 每頁筆數(預設 20,最大 100)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
searchNo
membershipNo
pageNo
per_pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'list_projects' MCP tool implementation in server.py. It handles tool registration with @mcp.tool(), validates input via GitLab client, and formats the output for the user.
    @mcp.tool()
    def list_projects(search: str = None, membership: bool = True,
                      page: int = 1, per_page: int = 20) -> str:
        """列出可存取的 GitLab 專案
    
        Args:
            search: 搜尋關鍵字(專案名稱)
            membership: 僅列出已加入的專案(預設 True)
            page: 頁碼(預設 1)
            per_page: 每頁筆數(預設 20,最大 100)
        """
        try:
            client = get_client()
            projects = client.list_projects(search=search, membership=membership,
                                            page=page, per_page=per_page)
            if not projects:
                return "找不到符合條件的專案"
    
            lines = [f"找到 {len(projects)} 個專案:\n"]
            for p in projects:
                desc = p.get("description") or ""
                if len(desc) > 60:
                    desc = desc[:60] + "..."
                lines.append(
                    f"- [{p['id']}] {p['path_with_namespace']}"
                    f"\n  {desc}"
                    f"\n  預設分支: {p.get('default_branch', 'N/A')} | {p.get('web_url', '')}\n"
                )
            return "\n".join(lines)
        except GitLabAPIError as e:
            return f"列出專案失敗: {str(e)}"
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 pagination and search filtering, which is useful, but lacks critical details: it doesn't specify authentication requirements, rate limits, error conditions, or whether it's a read-only operation (though 'list' implies non-destructive). For a tool with no annotations, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized. It starts with a clear purpose statement, followed by a bullet-point-like 'Args' section that efficiently documents parameters. Every sentence earns its place, though it could be slightly more front-loaded by integrating parameter details more seamlessly.

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 (4 parameters, no annotations, but with an output schema), the description is reasonably complete. It covers the purpose and all parameters in detail. Since an output schema exists, it doesn't need to explain return values. However, it lacks behavioral context (e.g., auth, errors), which slightly reduces completeness for a tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explains each parameter in Chinese: 'search' for project name keywords, 'membership' to filter to joined projects (default True), 'page' for pagination (default 1), and 'per_page' for items per page (default 20, max 100). This fully compensates for the schema's lack of descriptions, providing clear semantics and constraints.

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: '列出可存取的 GitLab 專案' (List accessible GitLab projects). It specifies the resource (GitLab projects) and scope (accessible ones), though it doesn't explicitly differentiate from siblings like 'get_project' which retrieves a single project. The verb '列出' (list) is appropriate for this collection operation.

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 doesn't mention sibling tools like 'get_project' (for single project details) or 'list_project_members' (for project members), nor does it specify prerequisites or contexts where this tool is preferred. 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/snowild/gitlab-mcp'

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