Fetch test artifacts
wopee_fetch_artifactRetrieve a test artifact from an analysis suite, such as user stories or Playwright test code. Returns the content as text for review or editing, without modifying any data.
Instructions
Retrieve a specific test artifact from a suite. Returns the artifact content as text. Use this to review what wopee_generate_artifact created, or to retrieve existing artifacts before editing with wopee_update_artifact. Does NOT modify any data — this is a read-only operation. If the requested artifact type has not been generated yet for this suite, returns an empty result. For PLAYWRIGHT_CODE, you must provide the test case identifier (e.g. 'US004:TC006'); omitting it returns an error. For all other types, the identifier parameter is ignored.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Type of test artifact to retrieve. One of: APP_CONTEXT (application description), GENERAL_USER_STORIES (stories without test cases), USER_STORIES (stories with test cases), PLAYWRIGHT_CODE (generated test code — requires identifier), PROJECT_CONTEXT (project-level context). | |
| suiteUuid | Yes | UUID of the analysis suite to fetch artifacts from. 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:22-68 (handler)The core handler function `fetchArtifact` that executes the tool logic: validates input via Zod schema, builds a GraphQL input, calls the API via `requestClient`, and returns the artifact content as text.
export async function fetchArtifact(input: FetchArtifactHandlerInput): Promise<{ content: { type: "text"; text: string; }[]; }> { try { const { type, suiteUuid, identifier } = input; const fetchArtifactInput = createFetchArtifactInput({ type, suiteUuid, ...(identifier ? { identifier } : {}), }); const parsedInput = FetchArtifactInputSchema.parse(fetchArtifactInput); const result = await requestClient<{ fetchArtifact: { content: string | null; blobSha: string | null; commitSha: string | null; commitDate: string | null; }; }>(FetchArtifact, { input: parsedInput, }); if (!result?.fetchArtifact?.content) return { content: [ { type: "text" as const, text: "Failed to fetch file: no content returned", }, ], }; return { content: [ { type: "text" as const, text: result.fetchArtifact.content, }, ], }; } catch (error) { return _parseError(error); } } - The tool definition object `wopeeFetchArtifact` that wires the tool name, metadata/description, input schema, and delegates to the shared `fetchArtifact` handler.
export const wopeeFetchArtifact = { name: ToolName.WOPEE_FETCH_ARTIFACT, config: { title: "Fetch test artifacts", description: "Retrieve a specific test artifact from a suite. Returns the artifact content as text. Use this to review what wopee_generate_artifact created, or to retrieve existing artifacts before editing with wopee_update_artifact. Does NOT modify any data — this is a read-only operation. If the requested artifact type has not been generated yet for this suite, returns an empty result. For PLAYWRIGHT_CODE, you must provide the test case identifier (e.g. 'US004:TC006'); omitting it returns an error. For all other types, the identifier parameter is ignored.", inputSchema: FetchArtifactHandlerInputSchema.shape, }, handler: async (input: FetchArtifactHandlerInput) => await fetchArtifact(input), }; - src/tools/shared/schemas.ts:43-60 (schema)`FetchArtifactHandlerInputSchema` — input schema for the tool handler: validates type (ArtifactType enum), suiteUuid, and optional identifier.
export const FetchArtifactHandlerInputSchema = z.object({ type: z.nativeEnum(ArtifactType, { description: "Type of test artifact to retrieve. One of: APP_CONTEXT (application description), GENERAL_USER_STORIES (stories without test cases), USER_STORIES (stories with test cases), PLAYWRIGHT_CODE (generated test code — requires identifier), PROJECT_CONTEXT (project-level context).", }), suiteUuid: z .string({ description: "UUID of the analysis suite to fetch artifacts from. 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:73-84 (schema)`FetchArtifactInputSchema` — internal input schema used after factory transformation, includes projectUuid, suiteUuid, type, optional identifier and ref.
export const FetchArtifactInputSchema = z.object({ projectUuid: z.string().min(1, "Project UUID is required"), suiteUuid: z.string().min(1, "Suite UUID is required"), type: z.nativeEnum(ArtifactType), identifier: z .string({ description: "Identifier for the test case to fetch playwright code for, ex. `US004:TC006`, should be provided only for `PLAYWRIGHT_CODE` artifact type", }) .nullish(), ref: z.string().nullish(), // branch, tag or commit sha }); - src/tools/index.ts:1-28 (registration)Tool registration: `wopeeFetchArtifact` is imported and added to the `TOOLS` array at line 21, making it available as an MCP tool.
import { wopeeFetchArtifact } from "./wopee_fetch_artifact/index.js"; import { wopeeUpdateArtifact } from "./wopee_update_artifact/index.js"; import { wopeeGenerateArtifact } from "./wopee_generate_artifact/index.js"; import { wopeeDispatchAgent } from "./wopee_dispatch_agent/index.js"; import { wopeeDispatchAnalysis } from "./wopee_dispatch_analysis/index.js"; import { wopeeCreateBlankSuite } from "./wopee_create_blank_suite/index.js"; import { wopeeFetchAnalysisSuites } from "./wopee_fetch_analysis_suites/index.js"; import { wopeeFetchExecutedTestCases } from "./wopee_fetch_executed_test_cases/index.js"; import { wopeeSendChatMessage } from "./wopee_send_chat_message/index.js"; import { wopeeReadChatHistory } from "./wopee_read_chat_history/index.js"; import { wopeeCreateGithubIssue } from "./wopee_create_github_issue/index.js"; export const TOOLS = [ wopeeCreateBlankSuite, wopeeFetchAnalysisSuites, wopeeFetchExecutedTestCases, wopeeDispatchAnalysis, wopeeDispatchAgent, wopeeFetchArtifact, wopeeUpdateArtifact, wopeeGenerateArtifact, wopeeSendChatMessage, wopeeReadChatHistory, wopeeCreateGithubIssue, ];