Skip to content

Commit 95e6b43

Browse files
committed
fix(2528): recover userdata workflow paths
1 parent 82861e4 commit 95e6b43

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

docs/tools/workflow-library.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Return, list, summarize or query a SAVED workflow FILE — files on disk, named
3636
Options: `ui`, `api`, `raw`.
3737
</ParamField>
3838
<ParamField path="path" type="string">
39-
action:"strip" / "slice" / "query" — Absolute server-side path to a workflow .json on disk (e.g. C:\\Users\\you\\ComfyUI\\user\\default\\workflows\\pusa_extend.json). Read directly from disk — no library lookup.
39+
action:"strip" / "slice" / "query" — Absolute server-side path to a workflow .json on disk (e.g. C:\\Users\\you\\ComfyUI\\user\\default\\workflows\\pusa_extend.json). Read directly from disk — no library lookup. If a userdata path is missing the `workflows` segment after `user/default`, it is retried with that segment restored, preserving the filename exactly.
4040
</ParamField>
4141
<ParamField path="graph" type="object">
4242
action:"strip" / "slice" / "query" — Inline workflow JSON (UI format for "strip"/"slice"; UI or API for "query"), as an alternative to path/filename.

src/__tests__/tools/get-workflow-userdata-workflows-path.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ describe("#2528 get_workflow strip keeps the userdata workflows segment", () =>
148148
expect(mocks.fetchApi).not.toHaveBeenCalled();
149149
});
150150

151+
it('action:"strip" also repairs an absolute `filename` from the same userdata tree', async () => {
152+
const res = await getHandler()({ action: "strip", filename: droppedFile, format: "raw" });
153+
154+
expect(res.isError).toBeUndefined();
155+
expect(text(res)).not.toMatch(/ENOENT/);
156+
expect(JSON.parse(res.content[0]!.text)).toEqual(GRAPH);
157+
expect(mocks.fetchApi).not.toHaveBeenCalled();
158+
});
159+
151160
it("does not find a hyphen-mangled stand-in when only the em-dash file exists", async () => {
152161
const mangled = join(
153162
workspace,

src/tools/workflow-library.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ export function registerWorkflowLibraryTools(server: McpServer): void {
313313
.optional()
314314
.describe(
315315
'action:"strip" / "slice" / "query" — Absolute server-side path to a workflow .json on disk (e.g. ' +
316-
"C:\\\\Users\\\\you\\\\ComfyUI\\\\user\\\\default\\\\workflows\\\\pusa_extend.json). Read directly from disk — no library lookup.",
316+
"C:\\\\Users\\\\you\\\\ComfyUI\\\\user\\\\default\\\\workflows\\\\pusa_extend.json). Read directly from disk — no library lookup. If a userdata path is missing the `workflows` segment after `user/default`, it is retried with that segment restored, preserving the filename exactly.",
317317
),
318318
graph: z
319319
.record(z.string(), z.any())

0 commit comments

Comments
 (0)