Skip to main content
Glama

create_or_update_file

Create or update a single file in a GitLab project with a commit, specifying branch, path, content, and commit message. Handles text or base64 encoding for binary files.

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.
jmespathNoOptional JMESPath expression filtering the JSON result before return.
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.

  1. Changed1 schema field changedv2.1.66
    • addedInput schema / properties / jmespath
      Added value: +{
      +  "description": "Optional JMESPath expression filtering the JSON result before return.",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv2.1.62
    • changedInput schema / required
      Previous value: -[
      -  "file_path",
      -  "content",
      -  "commit_message",
      -  "branch",
      -  "project_id"
      -]New value: +[
      +  "project_id",
      +  "file_path",
      +  "content",
      +  "commit_message",
      +  "branch"
      +]
  3. 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"
      +}
  4. Addedv2.1.45
  5. Removedv2.1.43
  6. Addedv2.1.18
  7. Removedv2.1.14
  8. Addedv2.1.11
  9. Removedv2.1.10
  10. 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"
      +]
  11. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

With no readOnly/destructive annotations to rely on, the description discloses that the operation mutates remote content in a commit, requires repository write permission, and returns a commit result or conflict/validation error. This gives the agent the key safety and outcome information it needs.

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?

Three sentences, all functional: purpose/routing, encoding behavior, and permission/return summary. No filler or repeated information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having 10 parameters and no output schema, the description covers what an agent needs: when to use it, what it does, required permissions, and the kind of result or error to expect. Optional parameters are fully covered by the schema.

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 all parameters. The description adds the encoding default and permission context but does not meaningfully enrich the other parameters beyond the schema baseline.

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 opens with a clear verb-resource pair ('Create or update a file in a GitLab project') and explicitly positions itself as the single-file counterpart to `push_files`. An agent can distinguish this from its siblings immediately.

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 states the intended use case (single repository file) and names the alternative (`push_files` for a multi-file commit), which is explicit routing guidance. It also adds the encoding default behavior for backward compatibility, giving practical context for existing callers.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools