We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 160feee commit f7b9664Copy full SHA for f7b9664
CHANGELOG.md
@@ -2,6 +2,7 @@
2
3
- Added the `refresh_gists` tool
4
- The list of gist resources are now sorted by modified date (descending)
5
+- Empty gist files can now be created (if desired)
6
7
## 📆 v0.4.4 (06/12/2025)
8
src/tools/files.ts
@@ -1,5 +1,6 @@
1
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
import { Gist, RequestContext, ToolModule } from "../types.js";
+import { gistContent } from "../utils.js";
type FileAssertions = {
exists?: string;
@@ -154,7 +155,9 @@ export default {
154
155
156
await assertGistFile(context, id, { exists: filename });
157
- await patchGistFile(context, id, filename, { content });
158
+ await patchGistFile(context, id, filename, {
159
+ content: gistContent(content),
160
+ });
161
162
return "File updated successfully";
163
},
@@ -168,7 +171,9 @@ export default {
168
171
169
172
await assertGistFile(context, id, { notExists: filename });
170
173
174
175
176
177
178
return "File added successfully";
179
src/tools/gist.ts
@@ -1,6 +1,7 @@
import { Gist, ToolModule } from "../types.js";
import {
+ gistContent,
isArchivedGist,
isDailyNoteGist,
isPromptGist,
@@ -138,7 +139,7 @@ export default {
138
139
const {
140
description = "",
141
filename = "README.md",
- content,
142
+ content = "",
143
public: isPublic = false,
144
} = args;
145
@@ -154,7 +155,7 @@ export default {
public: isPublic,
files: {
[filename as string]: {
+ content: gistContent(content as string),
});
src/utils.ts
@@ -36,4 +36,11 @@ export function isPromptGist(gist: Gist): boolean {
36
37
export function isContentLoaded(gist: Gist): boolean {
38
return Object.values(gist.files).every((file) => file.content !== undefined);
39
+}
40
+
41
+// Gist's aren't allowed to be empty, so we're using an
42
+// "invisible plus" as content when the content is empty.
43
+const EMPTY_FILE_CONTENT = "\u{2064}";
44
+export function gistContent(content: string): string {
45
+ return content || EMPTY_FILE_CONTENT;
46
}
0 commit comments