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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project ID or complete URL-encoded path to project | |
| file_path | Yes | Path where to create/update the file | |
| content | Yes | Content of the file | |
| commit_message | Yes | Commit message | |
| branch | Yes | Branch to create/update the file in | |
| previous_path | No | Path of the file to move/rename | |
| last_commit_id | No | Last known file commit ID | |
| commit_id | No | Current file commit ID (for update operations) |
Implementation Reference
- schemas.ts:1035-1043 (schema)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)"), });