Skip to main content
Glama

gitlab_get_user_snippets

Retrieve and manage code snippets created by a specific GitLab user across personal and project scopes, including content, metadata, and visibility settings for code reuse and knowledge sharing.

Instructions

List all personal and project snippets created by a user

Find all code snippets created by the specified user across personal and project scopes, with content and metadata.

Returns snippet information with:

  • Snippet details: title, description, visibility

  • Content info: file names, language detection

  • Usage context: project association, sharing scope

  • Metadata: creation date, update history

  • Access info: permissions, visibility settings

Use cases:

  • Personal code library management

  • Knowledge sharing and documentation

  • Code reuse and template management

  • Developer portfolio and examples

Parameters:

  • user_id: Numeric user ID

  • username: Username string (use either user_id or username)

  • scope: Snippet scope (personal, project, all)

  • visibility: Filter by visibility (private, internal, public)

  • language: Filter by programming language

  • sort: Sort order (created, updated, name)

  • per_page: Results per page (default: 20)

  • page: Page number (default: 1)

Example: Get user's public snippets

{
  "username": "johndoe",
  "visibility": "public", 
  "sort": "created"
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameYesUsername string
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

  • The handler function that implements the core logic for the gitlab_get_user_snippets tool. It validates input arguments (requiring 'username'), sets defaults for pagination, and delegates to GitLabClient.get_user_snippets().
    def handle_get_user_snippets(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting user's snippets"""
        username = get_argument(arguments, "username")
        if not username:
            raise ValueError("username is required")
        
        per_page = get_argument(arguments, "per_page", DEFAULT_PAGE_SIZE)
        page = get_argument(arguments, "page", 1)
        
        return client.get_user_snippets(
            username=username,
            per_page=per_page,
            page=page
        )
  • Pydantic/MCP schema definition for the gitlab_get_user_snippets tool, including input validation schema with required 'username' and optional pagination/visibility parameters.
    types.Tool(
        name=TOOL_GET_USER_SNIPPETS,
        description=desc.DESC_GET_USER_SNIPPETS,
        inputSchema={
            "type": "object",
            "properties": {
                "username": {"type": "string", "description": "Username string"},
                "visibility": {"type": "string", "description": "Snippet visibility", "enum": ["public", "internal", "private", "all"], "default": "all"},
                "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": ["username"]
        }
    ),
  • Registration of the tool handler in the TOOL_HANDLERS dictionary, which is used by server.py to dispatch tool calls to the appropriate handler function.
    TOOL_GET_USER_CODE_CHANGES_SUMMARY: handle_get_user_code_changes_summary,
    TOOL_GET_USER_SNIPPETS: handle_get_user_snippets,
  • Constant defining the exact tool name string 'gitlab_get_user_snippets' used across the codebase for consistency.
    TOOL_GET_USER_SNIPPETS = "gitlab_get_user_snippets"
Behavior3/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 does well by describing the return format ('Returns snippet information with...') and pagination behavior (via per_page and page parameters), but doesn't mention rate limits, authentication requirements, or whether this is a read-only operation. The description implies it's a safe read operation but doesn't explicitly state this.

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 with clear sections (purpose, returns, use cases, parameters, example) and front-loads the core functionality. However, it's somewhat verbose with detailed bullet points in the returns section that could be more concise. The parameter section lists many parameters not in the actual schema, creating some redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, 100% schema coverage, and no output schema, the description provides good context about return values and use cases. However, there's a significant mismatch between the 8 parameters described and the 3 parameters in the actual schema, creating confusion. The description compensates for the lack of output schema by detailing return information, but the parameter discrepancy reduces overall completeness.

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

Parameters4/5

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

The schema description coverage is 100%, so the schema already documents all 3 parameters. The description adds significant value by listing 8 parameters with semantic explanations (scope, visibility, language, sort, etc.) that aren't in the actual schema. This provides crucial context about filtering capabilities beyond the minimal required parameters, though there's a disconnect between described parameters and actual schema.

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 with specific verb ('List all personal and project snippets created by a user') and resource ('code snippets'), and distinguishes it from sibling tools like 'gitlab_get_snippet' (singular) and 'gitlab_list_snippets' (general listing). The title 'List all...' establishes this as a filtered listing operation focused on user-created snippets.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool ('Find all code snippets created by the specified user across personal and project scopes') and includes use cases like 'Personal code library management' and 'Code reuse and template management.' However, it doesn't explicitly state when NOT to use it or mention alternatives like 'gitlab_list_snippets' for general snippet browsing or 'gitlab_get_snippet' for single snippet details.

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