You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/github/__toolsnaps__/create_or_update_file.snap
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
"annotations": {
3
3
"title": "Create or update file"
4
4
},
5
-
"description": "Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.",
5
+
"description": "Create or update a single file in a GitHub repository. \nIf updating, you should provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.\n\nIn order to obtain the SHA of original file version before updating, use the following git command:\ngit ls-tree HEAD \u003cpath to file\u003e\n\nIf the SHA is not provided, the tool will attempt to acquire it by fetching the current file contents from the repository, which may lead to rewriting latest committed changes if the file has changed since last retrieval.\n",
6
6
"inputSchema": {
7
7
"type": "object",
8
8
"required": [
@@ -40,7 +40,7 @@
40
40
},
41
41
"sha": {
42
42
"type": "string",
43
-
"description": "Required if updating an existing file. The blob SHA of the file being replaced."
43
+
"description": "The blob SHA of the file being replaced."
Copy file name to clipboardExpand all lines: pkg/github/repositories.go
+75-3Lines changed: 75 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -310,8 +310,15 @@ func ListBranches(getClient GetClientFn, t translations.TranslationHelperFunc) (
310
310
// CreateOrUpdateFile creates a tool to create or update a file in a GitHub repository.
311
311
funcCreateOrUpdateFile(getClientGetClientFn, t translations.TranslationHelperFunc) (mcp.Tool, mcp.ToolHandlerFor[map[string]any, any]) {
312
312
tool:= mcp.Tool{
313
-
Name: "create_or_update_file",
314
-
Description: t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", "Create or update a single file in a GitHub repository. If updating, you must provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations."),
313
+
Name: "create_or_update_file",
314
+
Description: t("TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION", `Create or update a single file in a GitHub repository.
315
+
If updating, you should provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.
316
+
317
+
In order to obtain the SHA of original file version before updating, use the following git command:
318
+
git ls-tree HEAD <path to file>
319
+
320
+
If the SHA is not provided, the tool will attempt to acquire it by fetching the current file contents from the repository, which may lead to rewriting latest committed changes if the file has changed since last retrieval.
321
+
`),
315
322
Annotations: &mcp.ToolAnnotations{
316
323
Title: t("TOOL_CREATE_OR_UPDATE_FILE_USER_TITLE", "Create or update file"),
317
324
ReadOnlyHint: false,
@@ -345,7 +352,7 @@ func CreateOrUpdateFile(getClient GetClientFn, t translations.TranslationHelperF
345
352
},
346
353
"sha": {
347
354
Type: "string",
348
-
Description: "Required if updating an existing file. The blob SHA of the file being replaced.",
355
+
Description: "The blob SHA of the file being replaced.",
0 commit comments