Skip to main content
Glama

MCP GitLab Server

by Vijay-Duke

gitlab_create_snippet

Create and manage code snippets on GitLab for saving reusable code, sharing solutions, and documenting examples. Specify title, file name, and content, with optional description and visibility settings.

Instructions

Create a new code snippet Creates: New snippet with specified content and metadata Use when: Saving reusable code, sharing solutions, documenting examples Required: title, file_name, content Optional: description, visibility

Example usage: { "title": "Docker Compose Template", "file_name": "docker-compose.yml", "content": "version: '3.8'\nservices:\n app:\n image: nginx", "description": "Basic Docker Compose setup", "visibility": "internal" }

Returns: Created snippet with ID and URLs

Related tools:

  • gitlab_update_snippet: Modify after creation
  • gitlab_list_snippets: View created snippets

Input Schema

NameRequiredDescriptionDefault
contentYesSnippet content Type: string Format: Raw text content of the snippet Example: 'console.log("Hello World");' Note: Can be code, text, or any content type
descriptionNoSnippet description Type: string Format: Optional description of the snippet Example: 'Helper script for database migrations' Note: Provides context about the snippet's purpose
file_nameYesSnippet file name Type: string Format: File name with extension Example: 'migration.sql', 'helper.py', 'config.yaml' Note: Used for syntax highlighting and display
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
titleYesSnippet title Type: string Format: Descriptive title for the snippet Example: 'Database migration script' Note: Required when creating snippets
visibilityNoSnippet visibility Type: string Format: Visibility level for the snippet Options: 'private' | 'internal' | 'public' Default: 'private' Examples: - 'private' (only visible to author) - 'internal' (visible to authenticated users) - 'public' (visible to everyone)private

Input Schema (JSON Schema)

{ "properties": { "content": { "description": "Snippet content\nType: string\nFormat: Raw text content of the snippet\nExample: 'console.log(\"Hello World\");'\nNote: Can be code, text, or any content type", "type": "string" }, "description": { "description": "Snippet description\nType: string\nFormat: Optional description of the snippet\nExample: 'Helper script for database migrations'\nNote: Provides context about the snippet's purpose", "type": "string" }, "file_name": { "description": "Snippet file name\nType: string\nFormat: File name with extension\nExample: 'migration.sql', 'helper.py', 'config.yaml'\nNote: Used for syntax highlighting and display", "type": "string" }, "project_id": { "description": "Project identifier (auto-detected if not provided)\nType: integer OR string\nFormat: numeric ID or 'namespace/project'\nOptional: Yes - auto-detects from current git repository\nExamples:\n - 12345 (numeric ID)\n - 'gitlab-org/gitlab' (namespace/project path)\n - 'my-group/my-subgroup/my-project' (nested groups)\nNote: If in a git repo with GitLab remote, this can be omitted", "type": "string" }, "title": { "description": "Snippet title\nType: string\nFormat: Descriptive title for the snippet\nExample: 'Database migration script'\nNote: Required when creating snippets", "type": "string" }, "visibility": { "default": "private", "description": "Snippet visibility\nType: string\nFormat: Visibility level for the snippet\nOptions: 'private' | 'internal' | 'public'\nDefault: 'private'\nExamples:\n - 'private' (only visible to author)\n - 'internal' (visible to authenticated users)\n - 'public' (visible to everyone)", "enum": [ "private", "internal", "public" ], "type": "string" } }, "required": [ "title", "file_name", "content" ], "type": "object" }

Other Tools from MCP GitLab Server

Related Tools

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