gitlab_update_snippet
Modify existing GitLab snippets by updating title, content, file name, description, or visibility settings to fix code, update examples, or change permissions.
Instructions
Update existing snippet Modifies: Title, content, file name, description, or visibility Use when: Fixing code, updating examples, changing permissions Flexibility: Update any combination of fields
Example usage: { "snippet_id": 123, "title": "Updated API Helper", "content": "// Updated with error handling\nfunction fetchData(url) { ... }", "description": "Enhanced with proper error handling" }
Returns: Updated snippet information
Related tools:
gitlab_get_snippet: View current content before updating
gitlab_create_snippet: Create new instead of updating
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project 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_id | Yes | Snippet ID Type: integer Format: Numeric snippet identifier Example: 123 How to find: From snippet URL or API responses | |
| title | No | Snippet title Type: string Format: Descriptive title for the snippet Example: 'Database migration script' Note: Required when creating snippets | |
| file_name | No | Snippet file name Type: string Format: File name with extension Example: 'migration.sql', 'helper.py', 'config.yaml' Note: Used for syntax highlighting and display | |
| content | No | Snippet content Type: string Format: Raw text content of the snippet Example: 'console.log("Hello World");' Note: Can be code, text, or any content type | |
| description | No | Snippet description Type: string Format: Optional description of the snippet Example: 'Helper script for database migrations' Note: Provides context about the snippet's purpose | |
| visibility | No | Snippet 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) |