Skip to main content
Glama

gitlab_batch_operations

Execute multiple GitLab operations atomically with automatic rollback on failure, enabling complex multi-step workflows where all steps succeed or none apply.

Instructions

Execute multiple operations atomically Returns: Results of all operations or rollback Use when: Complex multi-step workflows Feature: Reference previous operation results

Key benefits:

  • All-or-nothing execution

  • Operation chaining

  • Automatic rollback

  • Result references: {{op1.field}}

Example workflow:

  1. Create branch

  2. Add files

  3. Create MR All succeed or all rolled back

Related tools:

  • Individual operation tools

  • gitlab_safe_preview_commit: Test first

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
operationsYesBatch operations list Type: array of objects Required: Yes Structure: { "name": "string (operation identifier)", "tool": "string (GitLab tool name)", "arguments": "object (tool-specific arguments)" } Features: - Sequential execution - Result referencing: {{operation_name.field}} - Automatic rollback on failure Examples: [ { "name": "create_branch", "tool": "gitlab_create_branch", "arguments": { "branch": "feature/new-feature", "ref": "main" } }, { "name": "create_file", "tool": "gitlab_create_commit", "arguments": { "branch": "{{create_branch.name}}", "commit_message": "Add new feature", "actions": [{ "action": "create", "file_path": "feature.py", "content": "# New feature" }] } }, { "name": "create_mr", "tool": "gitlab_create_merge_request", "arguments": { "source_branch": "{{create_branch.name}}", "target_branch": "main", "title": "Add new feature" } } ] Use cases: - Complex workflows - Dependent operations - Atomic multi-step changes
stop_on_errorNoError handling strategy Type: boolean Default: true Options: - true: Stop and rollback on first error - false: Continue, collect all errors Use cases: - true: Critical operations requiring all-or-nothing - false: Best-effort batch processing

Implementation Reference

  • The primary handler function that implements the core logic of the gitlab_batch_operations tool. It parses input arguments, resolves the project ID (auto-detecting from git if not provided), and executes batch operations via the GitLabClient.
    def handle_batch_operations(client: GitLabClient, arguments: Optional[Dict[str, Any]]) -> Dict[str, Any]:
        """Handle batch operations"""
        project_id = require_project_id(client, arguments)
        operations = require_argument(arguments, "operations")
        stop_on_error = get_argument(arguments, "stop_on_error", True)
        
        return client.batch_operations(project_id, operations, stop_on_error)
  • Defines the input schema and parameters for the gitlab_batch_operations tool, including the structure for the operations array (each with name, tool, arguments) and optional project_id and stop_on_error.
    types.Tool(
        name=TOOL_BATCH_OPERATIONS,
        description=desc.DESC_BATCH_OPERATIONS,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "operations": {
                    "type": "array",
                    "description": desc.DESC_OPERATIONS,
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {"type": "string", "description": "Operation name for reference"},
                            "tool": {"type": "string", "description": "GitLab tool name to execute"},
                            "arguments": {"type": "object", "description": "Arguments for the tool"}
                        },
                        "required": ["name", "tool", "arguments"]
                    }
                },
                "stop_on_error": {"type": "boolean", "description": desc.DESC_STOP_ON_ERROR, "default": True}
            },
            "required": ["operations"]
        }
    ),
  • Registers the handler function for gitlab_batch_operations in the central TOOL_HANDLERS dictionary, which is used by server.py to dispatch tool calls.
    TOOL_BATCH_OPERATIONS: handle_batch_operations,
  • Registers the gitlab_batch_operations tool definition (name, description, schema) in the TOOLS list used for tool listing and validation.
        name=TOOL_BATCH_OPERATIONS,
        description=desc.DESC_BATCH_OPERATIONS,
        inputSchema={
            "type": "object",
            "properties": {
                "project_id": {"type": "string", "description": desc.DESC_PROJECT_ID},
                "operations": {
                    "type": "array",
                    "description": desc.DESC_OPERATIONS,
                    "items": {
                        "type": "object",
                        "properties": {
                            "name": {"type": "string", "description": "Operation name for reference"},
                            "tool": {"type": "string", "description": "GitLab tool name to execute"},
                            "arguments": {"type": "object", "description": "Arguments for the tool"}
                        },
                        "required": ["name", "tool", "arguments"]
                    }
                },
                "stop_on_error": {"type": "boolean", "description": desc.DESC_STOP_ON_ERROR, "default": True}
            },
            "required": ["operations"]
        }
    ),
  • Constant definition providing the canonical string name for the gitlab_batch_operations tool, used consistently across definitions, registrations, and tests.
    TOOL_BATCH_OPERATIONS = "gitlab_batch_operations"
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 of behavioral disclosure. It effectively describes key traits: atomic execution ('All-or-nothing execution'), rollback behavior ('Automatic rollback'), and result referencing ('Reference previous operation results'). However, it lacks details on permissions, rate limits, or error handling beyond the stop_on_error parameter, 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 bullet points and an example workflow, making it easy to scan. However, it includes some redundancy (e.g., repeating 'automatic rollback' in multiple sections) and could be more front-loaded; the first sentence is clear, but subsequent details could be tighter.

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?

For a complex tool with 3 parameters, 100% schema coverage, and no output schema, the description does a good job covering usage, behavior, and examples. It addresses atomicity and chaining, but lacks output details (e.g., result format) and could better explain error scenarios, given the absence of annotations.

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?

Schema description coverage is 100%, so the schema documents parameters thoroughly. The description adds value by explaining the purpose of the 'operations' array ('Operation chaining', 'Result references') and contextualizing 'stop_on_error' in the example workflow, but doesn't significantly enhance parameter understanding beyond the schema's details.

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 verbs ('Execute multiple operations atomically') and distinguishes it from siblings by highlighting its batch nature. It explicitly contrasts with 'Individual operation tools' and positions itself for 'Complex multi-step workflows,' making its unique role evident.

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 provides explicit guidance on when to use this tool ('Use when: Complex multi-step workflows') and when not to (by referencing 'Individual operation tools' for simpler cases). It also mentions an alternative tool ('gitlab_safe_preview_commit: Test first') for testing, offering clear context for selection.

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