Skip to main content
Glama

create_or_update_file

Create a new file or update an existing one in a GitLab project by specifying the file path, content, branch, and commit message.

Instructions

Create or update a file in a GitLab project. Use this for a single repository file when you know whether the target path is new or already exists; use push_files for a multi-file commit. Optional encoding (text or base64) defaults to GITLAB_REPO_FILE_ENCODING so existing callers stay unchanged. The operation creates or updates remote content in a commit, requires repository write permission, and returns the commit result or a conflict/validation error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchYesBranch to create/update the file in
contentYesContent of the file
encodingNoContent encoding. Use 'base64' for binary files (content must already be base64-encoded). When omitted, GITLAB_REPO_FILE_ENCODING applies.
commit_idNoCurrent file commit ID (for update operations)
file_pathYesPath where to create/update the file
project_idYesProject ID or complete URL-encoded path to project
previous_pathNoPath of the file to move/rename
commit_messageYesCommit message
last_commit_idNoLast known file commit ID

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv2.1.52
    • addedInput schema / properties / encoding
      Added value: +{
      +  "description": "Content encoding. Use 'base64' for binary files (content must already be base64-encoded). When omitted, GITLAB_REPO_FILE_ENCODING applies.",
      +  "enum": [
      +    "text",
      +    "base64"
      +  ],
      +  "type": "string"
      +}
  2. Addedv2.1.45
  3. Removedv2.1.43
  4. Addedv2.1.18
  5. Removedv2.1.14
  6. Addedv2.1.11
  7. Removedv2.1.10
  8. Changed2 schema fields changedv2.1.9
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / required
      Previous value: -[
      -  "file_path",
      -  "content",
      -  "commit_message",
      -  "branch"
      -]New value: +[
      +  "file_path",
      +  "content",
      +  "commit_message",
      +  "branch",
      +  "project_id"
      +]
  9. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the minimal `openWorldHint` annotation, the description discloses the requirement for repository write permission and the possible outcomes ('returns the commit result or a conflict/validation error'). This adds meaningful behavioral context not present in annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

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

The description is compact and well-structured: it opens with the core functionality, then provides usage guidance, encoding details, and permission/error expectations in a logical order without superfluous text.

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 schema richness and the presence of sibling tools, the description covers the essential usage context (single file vs multi-file, permission requirement, error behavior). It does not mention the file move/rename capability via `previous_path`, but that is adequately described in the schema, so the description remains sufficiently complete for effective selection and invocation.

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?

The input schema already provides comprehensive descriptions for all parameters (100% coverage), including the encoding default and the purpose of commit_id/last_commit_id. The tool description adds little beyond repeating the encoding default, so it does not significantly enhance parameter understanding.

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 states a specific verb and resource: 'Create or update a file in a GitLab project.' It also differentiates from the sibling tool `push_files` by explicitly mentioning when to use each, 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?

It clearly instructs when to use this tool versus `push_files': 'Use this for a single repository file... use `push_files` for a multi-file commit.' This provides explicit selection criteria among alternatives.

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/zereight/gitlab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server