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
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | No | Branch name, defaults to the repository's default branch | |
| content | Yes | File content | |
| message | Yes | Commit message | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| path | Yes | File path | |
| repo | Yes | Repository path | |
| sha | No | File SHA, required when updating an existing file |
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.createOrUpdateFileserver.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 ); }, });
- index.ts:114-124 (handler)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 );