MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / execute

Method execute

src/tools/artifacts/artifact-tools.ts:82–97  ·  view source on GitHub ↗
(args: z.infer<typeof UpdateArgs>, ctx: ToolContext)

Source from the content-addressed store, hash-verified

80 description = 'Save a new version of an existing artifact. Previous versions are preserved (use artifact_rollback to go back). Pass the FULL new content, not a diff.';
81 argsSchema = UpdateArgs;
82 isReadOnly = false;
83 isDestructive = false;
84
85 async execute(args: z.infer<typeof UpdateArgs>, ctx: ToolContext): Promise<ToolResult> {
86 try {
87 const { manifest, absFile, version } = await updateArtifact(
88 ctx.cwd,
89 { id: resolveArtifactId(args), content: args.content, note: args.note },
90 (p, c) => ctx.transaction.write(p, c),
91 );
92 ctx.emit({ type: 'progress', message: `Updated artifact "${manifest.id}" → v${version}` });
93 return {
94 content: `Saved "${manifest.id}" v${version} at ${absFile}. It now has ${manifest.versions.length} version(s).`,
95 metadata: { artifactId: manifest.id, version, type: manifest.type, path: absFile },
96 };
97 } catch (e: any) {
98 return { content: e?.message ?? String(e), isError: true };
99 }
100 }

Callers

nothing calls this directly

Calls 4

updateArtifactFunction · 0.85
resolveArtifactIdFunction · 0.85
writeMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected