Skip to main content
Glama

create_or_update_file

Create or update files in Gitee repositories by specifying the repository path, file content, and commit message. Manage branches and file SHA for precise file operations.

Instructions

在 Gitee 仓库中创建或更新文件

Input Schema

NameRequiredDescriptionDefault
branchNoBranch name, defaults to the repository's default branch
contentYesFile content
messageYesCommit message
ownerYesRepository owner path (enterprise, organization, or personal path)
pathYesFile path
repoYesRepository path
shaNoFile SHA, required when updating an existing file

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "branch": { "description": "Branch name, defaults to the repository's default branch", "type": "string" }, "content": { "description": "File content", "type": "string" }, "message": { "description": "Commit message", "type": "string" }, "owner": { "description": "Repository owner path (enterprise, organization, or personal path)", "type": "string" }, "path": { "description": "File path", "type": "string" }, "repo": { "description": "Repository path", "type": "string" }, "sha": { "description": "File SHA, required when updating an existing file", "type": "string" } }, "required": [ "owner", "repo", "path", "content", "message" ], "type": "object" }

Implementation Reference

  • index.ts:110-126 (registration)
    Registration of the 'create_or_update_file' MCP tool, including name, description, schema from fileOperations, and a thin handler that delegates to fileOperations.createOrUpdateFile
    server.registerTool({ name: "create_or_update_file", description: "在 Gitee 仓库中创建或更新文件", schema: fileOperations.CreateOrUpdateFileSchema, handler: async (params: any) => { const { owner, repo, path, content, message, branch, sha } = params; return await fileOperations.createOrUpdateFile( owner, repo, path, content, message, branch, sha ); }, });
  • The tool handler function which destructures input parameters and invokes the underlying fileOperations.createOrUpdateFile implementation.
    handler: async (params: any) => { const { owner, repo, path, content, message, branch, sha } = params; return await fileOperations.createOrUpdateFile( owner, repo, path, content, message, branch, sha );

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/normal-coder/gitee-mcp-server'

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