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)"), });

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