Skip to main content
Glama

gitlab_list_group_projects

List and search projects within a GitLab group, optionally including subgroups, to browse and find projects in group hierarchies.

Instructions

List projects within a group Returns: Array of projects belonging to the specified group Use when: Browsing group projects, finding projects in group hierarchy Pagination: Yes (default 50 per page) Options: Include subgroup projects with include_subgroups=true

Example response: [{ "id": 456, "name": "project-one", "path_with_namespace": "my-group/project-one", "description": "First project in group", "web_url": "https://gitlab.com/my-group/project-one" }]

Related tools:

  • gitlab_get_group: Get group details

  • gitlab_get_project: Get full project details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYesGroup identifier Type: integer OR string Format: numeric ID or 'group/subgroup' path Required: Yes Examples: - 456 (numeric ID) - 'my-group' (group path) - 'parent-group/sub-group' (nested group path)
searchNoSearch query Type: string Matching: Case-insensitive, partial matching Searches in: Project names and descriptions Examples: - 'frontend' (finds 'frontend-app', 'old-frontend', etc.) - 'API' (matches 'api', 'API', 'GraphQL-API', etc.) Tip: Use specific terms for better results for projects
include_subgroupsNoInclude projects from subgroups Type: boolean Default: false Options: - true: Include all descendant group projects - false: Only direct group projects Use case: Navigating hierarchical group structures
per_pageNoNumber of results per page Type: integer Range: 1-100 Default: 20 Example: 50 (for faster browsing) Tip: Use smaller values (10-20) for detailed operations, larger (50-100) for listing
pageNoPage number for pagination Type: integer Range: ≥1 Default: 1 Example: 3 (to get the third page of results) Note: Use with per_page to navigate large result sets

Implementation Reference

  • Handler function that extracts parameters from arguments and delegates to GitLabClient.list_group_projects to list projects in a group.
    def handle_list_group_projects(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle listing projects within a group"""
        group_id = require_argument(arguments, "group_id")
        search = get_argument(arguments, "search")
        include_subgroups = get_argument(arguments, "include_subgroups", False)
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.list_group_projects(
            group_id, 
            search=search, 
            include_subgroups=include_subgroups,
            per_page=per_page, 
            page=page
        )
  • Pydantic/MCP input schema definition for the gitlab_list_group_projects tool, specifying parameters like group_id (required), search, include_subgroups, pagination.
    types.Tool(
        name=TOOL_LIST_GROUP_PROJECTS,
        description=desc.DESC_LIST_GROUP_PROJECTS,
        inputSchema={
            "type": "object",
            "properties": {
                "group_id": {"type": "string", "description": desc.DESC_GROUP_ID},
                "search": {"type": "string", "description": desc.DESC_SEARCH_TERM + " for projects"},
                "include_subgroups": {"type": "boolean", "description": desc.DESC_INCLUDE_SUBGROUPS, "default": False},
                "per_page": {"type": "integer", "description": desc.DESC_PER_PAGE, "default": DEFAULT_PAGE_SIZE, "minimum": 1, "maximum": MAX_PAGE_SIZE},
                "page": {"type": "integer", "description": desc.DESC_PAGE_NUMBER, "default": 1, "minimum": 1}
            },
            "required": ["group_id"]
        }
    ),
  • Registration of the handler function in the TOOL_HANDLERS dictionary used by server.call_tool() to dispatch tool calls.
    TOOL_LIST_GROUP_PROJECTS: handle_list_group_projects,
  • Dispatch logic in @server.call_tool() that looks up the handler from TOOL_HANDLERS dict and executes it with GitLab client and arguments.
        handler = TOOL_HANDLERS.get(name)
        if not handler:
            raise ValueError(f"Unknown tool: {name}")
        
        # Execute the handler
        result = handler(client, arguments)
        
        # Truncate response if too large
        result = truncate_response(result, MAX_RESPONSE_SIZE)
        
        return [types.TextContent(
            type="text",
            text=json.dumps(result, indent=2)
        )]
        
    except gitlab.exceptions.GitlabAuthenticationError as e:
        logger.error(f"Authentication failed: {e}")
        error_response = sanitize_error(e, ERROR_AUTH_FAILED)
        return [types.TextContent(type="text", text=json.dumps(error_response, indent=2))]
    except gitlab.exceptions.GitlabGetError as e:
        response_code = getattr(e, 'response_code', None)
        if response_code == 404:
            logger.warning(f"Resource not found: {e}")
            error_response = sanitize_error(e, ERROR_NOT_FOUND)
        elif response_code == 429:
            logger.warning(f"Rate limit exceeded: {e}")
            error_response = sanitize_error(e, ERROR_RATE_LIMIT)
        else:
            logger.error(f"GitLab API error: {e}")
            error_response = sanitize_error(e)
        return [types.TextContent(type="text", text=json.dumps(error_response, indent=2))]
    except gitlab.exceptions.GitlabError as e:
        logger.error(f"General GitLab error: {e}")
        error_response = sanitize_error(e)
        return [types.TextContent(type="text", text=json.dumps(error_response, indent=2))]
    except ValueError as e:
        logger.warning(f"Invalid input: {e}")
        error_response = sanitize_error(e, ERROR_INVALID_INPUT)
        return [types.TextContent(type="text", text=json.dumps(error_response, indent=2))]
    except Exception as e:
        logger.error(f"Unexpected error: {e}")
        error_response = sanitize_error(e, ERROR_GENERIC)
        return [types.TextContent(type="text", text=json.dumps(error_response, indent=2))]
  • Constant defining the exact tool name string 'gitlab_list_group_projects' used across handler mapping, schema, and server.
    TOOL_LIST_GROUP_PROJECTS = "gitlab_list_group_projects"
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 of behavioral disclosure. It effectively describes key behaviors: pagination ('Yes (default 50 per page)'), subgroup inclusion option, and the return format ('Array of projects'). However, it doesn't mention rate limits, authentication requirements, or error handling, leaving some 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 well-structured and front-loaded with key information (purpose, returns, usage, pagination, options). Each sentence serves a distinct purpose, and the example response and related tools sections add practical value without redundancy. No wasted words.

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?

For a read-only listing tool with 5 parameters and no output schema, the description is quite complete. It covers purpose, usage, pagination, options, and provides an example response. However, without annotations, it could benefit from mentioning authentication or rate limits, though the example response format partially compensates for the lack of output schema.

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 all 5 parameters. The description adds minimal value beyond the schema, mentioning only 'include_subgroups=true' as an option. It doesn't provide additional syntax, format details, or usage tips not already in the schema descriptions.

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 verb 'List' and resource 'projects within a group', making the purpose specific and unambiguous. It distinguishes from sibling tools like 'gitlab_list_projects' (general listing) and 'gitlab_get_project' (detailed view) by focusing on group-specific listing.

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 explicitly provides 'Use when: Browsing group projects, finding projects in group hierarchy', giving clear context for when to apply this tool. It also lists related tools ('gitlab_get_group', 'gitlab_get_project') to guide users toward alternatives for different needs.

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