create_or_update_file
Create or modify files in GitLab projects by specifying content, path, and commit details to manage repository files through API operations.
Instructions
Create or update a single file in a GitLab project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | 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:789-797 (schema)Zod input schema definition for the 'create_or_update_file' tool, extending ProjectParamsSchema with parameters for file path, content, commit message, branch, and optional fields for rename/update.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)"), });
- schemas.ts:484-489 (schema)Zod response schema for GitLab create/update file operation, used by the tool.export const GitLabCreateUpdateFileResponseSchema = z.object({ file_path: z.string(), branch: z.string(), commit_id: z.string().optional(), // Optional since it's not always returned by the API content: GitLabFileContentSchema.optional(), });