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

Method execute

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

Source from the content-addressed store, hash-verified

49 description = 'Create a new versioned artifact (a self-contained web page, React component, SVG, or doc the user will keep and iterate on). Returns the artifact id. Prefer this over dumping a large standalone file into chat.';
50 argsSchema = CreateArgs;
51 isReadOnly = false;
52 isDestructive = false;
53
54 async execute(args: z.infer<typeof CreateArgs>, ctx: ToolContext): Promise<ToolResult> {
55 if (!isArtifactType(args.type)) {
56 return { content: `Invalid artifact type "${args.type}". Use one of: ${TYPE_VALUES.join(', ')}.`, isError: true };
57 }
58 const { manifest, absFile } = await createArtifact(
59 ctx.cwd,
60 { title: args.title, type: args.type as ArtifactType, content: args.content, note: args.note },
61 (p, c) => ctx.transaction.write(p, c),
62 );
63 ctx.emit({ type: 'progress', message: `Created artifact "${manifest.id}" (v1)` });
64 return {
65 content: `Created artifact "${manifest.id}" (${manifest.type}, v1) at ${absFile}. Use artifact_update with id="${manifest.id}" to revise it.`,
66 metadata: { artifactId: manifest.id, version: 1, type: manifest.type, path: absFile },
67 };
68 }

Callers

nothing calls this directly

Calls 4

isArtifactTypeFunction · 0.85
createArtifactFunction · 0.85
writeMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected