Skip to main content
Glama

create_or_update_file

Create or update a file in a GitLab project with specified content, commit message, and branch. Manage file operations including creation, updates, and renaming.

Instructions

Create or update a single file in a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject ID or complete URL-encoded path to project
file_pathYesPath where to create/update the file
contentYesContent of the file
commit_messageYesCommit message
branchYesBranch to create/update the file in
previous_pathNoPath of the file to move/rename
last_commit_idNoLast known file commit ID
commit_idNoCurrent file commit ID (for update operations)

Implementation Reference

  • Zod input schema for the 'create_or_update_file' tool. Defines parameters matching GitLab's PUT /projects/:id/repository/files/:file_path API endpoint for creating or updating repository files, including support for renaming via previous_path.
    export const CreateOrUpdateFileSchema = ProjectParamsSchema.extend({
      file_path: z.string().describe("Path where to create/update the file"),
      content: z.string().describe("Content of the file"),
      commit_message: z.string().describe("Commit message"),
      branch: z.string().describe("Branch to create/update the file in"),
      previous_path: z.string().optional().describe("Path of the file to move/rename"),
      last_commit_id: z.string().optional().describe("Last known file commit ID"),
      commit_id: z.string().optional().describe("Current file commit ID (for update operations)"),
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Create or update') but doesn't clarify permissions required, whether it overwrites existing files, how conflicts are handled (e.g., using 'last_commit_id'), or what the response looks like. For a mutation tool with 8 parameters, this leaves significant behavioral gaps.

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 a single, clear sentence that efficiently conveys the core purpose without redundancy. It's front-loaded with essential information and wastes no words, making it easy for an agent to parse quickly.

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

Completeness2/5

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

For a mutation tool with 8 parameters, no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., idempotency, error handling), usage context, and expected outcomes, leaving the agent under-informed despite the comprehensive 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 8 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining interactions between parameters (e.g., 'previous_path' for renaming). Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create or update') and resource ('a single file in a GitLab project'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'push_files' or 'get_file_contents', but the specificity of 'single file' operation is adequate for basic clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'push_files' (which might handle multiple files) or 'get_file_contents' (which is read-only). There's no mention of prerequisites, error conditions, or typical use cases, leaving the agent with minimal contextual direction.

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