Skip to main content
Glama

push_files

Push multiple files to a GitLab project in one commit using branch, commit message, and file content. Simplify file updates with batch processing.

Instructions

Push multiple files to a GitLab project in a single commit

Input Schema

NameRequiredDescriptionDefault
branchNo
commit_messageNo
filesNo
project_idNo

Input Schema (JSON Schema)

{ "properties": { "branch": { "type": "string" }, "commit_message": { "type": "string" }, "files": { "items": { "additionalProperties": false, "properties": { "content": { "type": "string" }, "path": { "type": "string" } }, "required": [ "path", "content" ], "type": "object" }, "type": "array" }, "project_id": { "type": "string" } }, "type": "object" }

Implementation Reference

  • Handler for the 'push_files' tool. Parses input arguments using PushFilesSchema, iterates over each file, and calls gitlabApi.createOrUpdateFile to push each file individually (noted as workaround for batch commit). Returns array of results.
    case "push_files": { const args = PushFilesSchema.parse(request.params.arguments); // Use individual file creation for each file instead of batch commit const results = []; for (const file of args.files) { try { const result = await gitlabApi.createOrUpdateFile( args.project_id, file.path, file.content, args.commit_message, args.branch ); results.push(result); } catch (error) { console.error(`Error creating/updating file ${file.path}:`, error); throw error; } } return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] }; }
  • Zod schema definition for 'push_files' tool input: requires project_id, array of files (path/content), commit_message, branch.
    export const PushFilesSchema = z.object({ project_id: z.string(), files: z.array(FileOperationSchema), commit_message: z.string(), branch: z.string() });
  • src/index.ts:132-137 (registration)
    Registration of the 'push_files' tool in the ALL_TOOLS array, including name, description, input schema, and readOnly flag. Used by ListToolsRequestSchema handler.
    { name: "push_files", description: "Push multiple files to a GitLab project in a single commit", inputSchema: createJsonSchema(PushFilesSchema), readOnly: false },
  • Supporting schema for file operations used in PushFilesSchema (files array). Defines path and content for each file.
    export const FileOperationSchema = z.object({ path: z.string(), content: z.string() });

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/yoda-digital/mcp-gitlab-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server