Skip to main content
Glama

gitlab_get_snippet

Retrieve GitLab snippet details and content for reviewing code implementations. Access complete snippet information including full text content.

Instructions

Get snippet details and content Returns: Complete snippet information with content Use when: Reading snippet code, reviewing implementations Content: Full text content included

Example response: { "id": 123, "title": "API Helper Functions", "file_name": "api_helpers.js", "content": "function fetchData(url) { ... }", "description": "Common API utility functions", "visibility": "internal", "author": {"name": "Jane Smith"}, "created_at": "2023-01-01T00:00:00Z", "web_url": "https://gitlab.com/group/project/snippets/123" }

Related tools:

  • gitlab_list_snippets: Browse available snippets

  • gitlab_update_snippet: Modify snippet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted
snippet_idYesSnippet ID Type: integer Format: Numeric snippet identifier Example: 123 How to find: From snippet URL or API responses

Implementation Reference

  • Handler function executing the gitlab_get_snippet tool: resolves project_id, requires snippet_id, calls GitLabClient.get_snippet()
    def handle_get_snippet(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle getting single snippet"""
        project_id = require_project_id(client, arguments)
        snippet_id = require_argument(arguments, "snippet_id")
        
        return client.get_snippet(project_id, snippet_id)
  • Pydantic/MCP input schema definition for gitlab_get_snippet tool, requiring snippet_id and optional project_id
        name=TOOL_GET_SNIPPET,
        description=desc.DESC_GET_SNIPPET,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "snippet_id": {"type": "integer", "description": desc.DESC_SNIPPET_ID}
            },
            "required": ["snippet_id"]
        }
    ),
  • Registration of gitlab_get_snippet tool name to its handler function in TOOL_HANDLERS dict used by server.call_tool()
    TOOL_GET_SNIPPET: handle_get_snippet,
  • Constant defining the tool name 'gitlab_get_snippet' used across schema, registration, and handler references
    TOOL_GET_SNIPPET = "gitlab_get_snippet"

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