Update test artifacts
wopee_update_artifactReplace the content of a test artifact in a suite with your own custom content, such as APP_CONTEXT or user stories, to upload or fix artifacts without prior generation.
Instructions
Create or overwrite a test artifact in a suite with caller-supplied content. The full content is replaced, not patched. Use this to upload your own APP_CONTEXT (e.g. built from JIRA / Confluence), user stories, project context, or Playwright code, or to fix / refine an artifact previously authored by wopee_generate_artifact. Works on any suite, including freshly-created blank suites with no prior generation — the artifact does not need to exist beforehand. Use wopee_generate_artifact instead when you want the Wopee.io AI engine to author the content from scratch. On success, returns confirmation. On failure (e.g. invalid suite UUID, storage misconfiguration), returns an error message. Idempotent: calling with the same content multiple times produces the same result.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Type of test artifact to update. One of: APP_CONTEXT, GENERAL_USER_STORIES, USER_STORIES, PLAYWRIGHT_CODE (requires identifier), PROJECT_CONTEXT. Must match the type used when the artifact was generated. | |
| content | Yes | The complete new content to replace the existing artifact. This is a destructive overwrite — the entire previous content is replaced. Pass the full updated content, not a partial diff. | |
| suiteUuid | Yes | UUID of the analysis suite containing the artifact to update. Get this from wopee_fetch_analysis_suites. | |
| identifier | No | Test case identifier in format 'US004:TC006'. Required only when type is PLAYWRIGHT_CODE. Ignored for all other artifact types. |
Implementation Reference
- src/tools/shared/handlers.ts:122-160 (handler)The `updateArtifact` function - the core handler that destructures input (type, suiteUuid, content, identifier), builds the update input via factory, validates with Zod schema, executes the UpdateArtifact GraphQL mutation, and returns success/failure.
export async function updateArtifact(input: UpdateArtifactHandlerInput) { try { const { type, suiteUuid, content, identifier } = input; const updateArtifactInput = createUpdateArtifactInput({ type, content, suiteUuid, ...(identifier ? { identifier } : {}), }); const parsedInput = UpdateArtifactInputSchema.parse(updateArtifactInput); const updateFileResult = await requestClient<{ updateArtifact: boolean; }>(UpdateArtifact, { input: parsedInput, }); if (!updateFileResult?.updateArtifact) return { content: [ { type: "text" as const, text: "Failed to update file: operation returned false", }, ], }; return { content: [ { type: "text" as const, text: "File updated successfully", }, ], }; } catch (error) { return _parseError(error); } } - src/tools/wopee_update_artifact/index.ts:1-18 (registration)The tool definition/registration for 'wopee_update_artifact' - exports a tool object with ToolName.WOPEE_UPDATE_ARTIFACT, metadata/description, inputSchema from UpdateArtifactHandlerInputSchema, and a handler delegation to updateArtifact().
import { UpdateArtifactHandlerInput, UpdateArtifactHandlerInputSchema, } from "../shared/schemas.js"; import { ToolName } from "../shared/types.js"; import { updateArtifact } from "../shared/handlers.js"; export const wopeeUpdateArtifact = { name: ToolName.WOPEE_UPDATE_ARTIFACT, config: { title: "Update test artifacts", description: "Create or overwrite a test artifact in a suite with caller-supplied content. The full content is replaced, not patched. Use this to upload your own APP_CONTEXT (e.g. built from JIRA / Confluence), user stories, project context, or Playwright code, or to fix / refine an artifact previously authored by wopee_generate_artifact. Works on any suite, including freshly-created blank suites with no prior generation — the artifact does not need to exist beforehand. Use wopee_generate_artifact instead when you want the Wopee.io AI engine to author the content from scratch. On success, returns confirmation. On failure (e.g. invalid suite UUID, storage misconfiguration), returns an error message. Idempotent: calling with the same content multiple times produces the same result.", inputSchema: UpdateArtifactHandlerInputSchema.shape, }, handler: async (input: UpdateArtifactHandlerInput) => await updateArtifact(input), }; - src/tools/shared/schemas.ts:86-107 (schema)Input schema (UpdateArtifactHandlerInputSchema) defining the validation for type (ArtifactType enum), content (string), suiteUuid (string), and optional identifier (string).
export const UpdateArtifactHandlerInputSchema = z.object({ type: z.nativeEnum(ArtifactType, { description: "Type of test artifact to update. One of: APP_CONTEXT, GENERAL_USER_STORIES, USER_STORIES, PLAYWRIGHT_CODE (requires identifier), PROJECT_CONTEXT. Must match the type used when the artifact was generated.", }), content: z.string({ description: "The complete new content to replace the existing artifact. This is a destructive overwrite — the entire previous content is replaced. Pass the full updated content, not a partial diff.", }), suiteUuid: z .string({ description: "UUID of the analysis suite containing the artifact to update. Get this from wopee_fetch_analysis_suites.", }) .min(1, "Suite UUID is required"), identifier: z .string({ description: "Test case identifier in format 'US004:TC006'. Required only when type is PLAYWRIGHT_CODE. Ignored for all other artifact types.", }) .optional(), }); - src/tools/shared/schemas.ts:142-148 (schema)TypeScript type UpdateArtifactHandlerInput inferred from the Zod schema, used in the handler signature.
export type UpdateArtifactHandlerInput = z.infer< typeof UpdateArtifactHandlerInputSchema >; export type UpdateArtifactFactoryInput = z.infer< typeof UpdateArtifactFactoryInputSchema >; export type UpdateArtifactInput = z.infer<typeof UpdateArtifactInputSchema>; - src/tools/shared/factories.ts:52-67 (helper)Factory function `createUpdateArtifactInput` that enriches user input with the project UUID from config, producing the full UpdateArtifactInput for the GraphQL mutation.
export const createUpdateArtifactInput = ( input: UpdateArtifactFactoryInput ): UpdateArtifactInput => { const { WOPEE_PROJECT_UUID } = getConfig(); if (!WOPEE_PROJECT_UUID) throw new Error("WOPEE_PROJECT_UUID is not set"); const { type, suiteUuid, content, identifier } = input; return { type, content, suiteUuid, projectUuid: WOPEE_PROJECT_UUID, ...(identifier ? { identifier } : {}), }; };