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"
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. It discloses key behavioral traits: it returns 'Complete snippet information with content' and includes an example response showing the structure. However, it doesn't mention potential errors (e.g., if snippet_id is invalid), rate limits, or authentication needs, 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.

Conciseness4/5

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

The description is well-structured with sections like 'Returns', 'Use when', 'Content', and 'Related tools', making it easy to scan. It includes an example response, which is helpful but adds length. Some redundancy exists (e.g., 'Content: Full text content included' could be merged), but overall it's efficient.

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 (2 parameters, no output schema, no annotations), the description is fairly complete. It explains the purpose, usage, and output via an example. However, it lacks details on error handling or authentication, which would be beneficial for full contextual understanding.

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 documents both parameters thoroughly. The description adds no additional parameter information beyond what the schema provides (e.g., no clarification on project_id auto-detection or snippet_id sourcing). This meets the baseline of 3 when schema coverage is high.

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 specific action ('Get snippet details and content') and resource ('snippet'), distinguishing it from siblings like gitlab_list_snippets (browsing) and gitlab_update_snippet (modifying). It explicitly mentions what is returned ('Complete snippet information with content'), making the purpose unambiguous.

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 includes an explicit 'Use when' section ('Reading snippet code, reviewing implementations'), providing clear context for when to invoke this tool. It also lists related tools with brief descriptions (e.g., gitlab_list_snippets for browsing, gitlab_update_snippet for modifying), offering alternatives and differentiation.

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